chore: initial project scaffold with Fastify server and Vite React app
Set up monorepo structure with server/ (Fastify + TypeScript) and web/ (React + Vite + TypeScript). Includes package configs, dev proxy setup, and mobile-first CSS foundation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2314
server/package-lock.json
generated
Normal file
2314
server/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
27
server/package.json
Normal file
27
server/package.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "spelljammer-server",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "tsx watch src/index.ts",
|
||||
"build": "tsc",
|
||||
"start": "node dist/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"fastify": "^5.2.1",
|
||||
"@fastify/static": "^8.1.0",
|
||||
"@fastify/cors": "^11.0.0",
|
||||
"socket.io": "^4.8.1",
|
||||
"better-sqlite3": "^11.8.1",
|
||||
"uuid": "^11.1.0",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.7.3",
|
||||
"tsx": "^4.19.3",
|
||||
"@types/better-sqlite3": "^7.6.13",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@types/node": "^18.19.0"
|
||||
}
|
||||
}
|
||||
3
server/src/config.ts
Normal file
3
server/src/config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const PORT = parseInt(process.env.PORT || '3000', 10);
|
||||
export const DB_PATH = process.env.DB_PATH || './data/spelljammer.sqlite';
|
||||
export const NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
20
server/src/index.ts
Normal file
20
server/src/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import Fastify from 'fastify';
|
||||
import { PORT } from './config.js';
|
||||
|
||||
const app = Fastify({ logger: true });
|
||||
|
||||
app.get('/', async () => {
|
||||
return { name: 'Spelljammer Ship Tracker API', status: 'ok' };
|
||||
});
|
||||
|
||||
const start = async () => {
|
||||
try {
|
||||
await app.listen({ port: PORT, host: '0.0.0.0' });
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
} catch (err) {
|
||||
app.log.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
start();
|
||||
19
server/tsconfig.json
Normal file
19
server/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
Reference in New Issue
Block a user