v1: delete old repo, initalize monorepo structure, config, database, and api packages basic setup

This commit is contained in:
2025-10-10 21:17:32 -04:00
parent ccceb77179
commit e7fff00001
75 changed files with 1362 additions and 1432 deletions

2
apps/api/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# deps
node_modules/

22
apps/api/package.json Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "@concord/api",
"scripts": {
"dev": "bun run --hot src/index.ts",
"build": "bun build src/index.ts",
"start": "bun src/index.ts",
"lint": "biome lint .",
"format": "biome format --write .",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@concord/database": "workspace:*",
"@hono/zod-validator": "^0.7.3",
"hono": "^4.9.10",
"zod": "^4.1.12"
},
"devDependencies": {
"@types/bun": "latest",
"@concord/biome-config": "workspace:*",
"@concord/tsconfig": "workspace:*"
}
}

37
apps/api/src/index.ts Normal file
View File

@@ -0,0 +1,37 @@
import { prisma } from '@concord/database'; // types from prisma
import { Hono } from 'hono';
import { logger } from 'hono/logger';
const app = new Hono();
app.use('*', logger());
// Health check
app.get('/', (c) => {
return c.json({ ok: true, message: 'Hello from the Concord API' });
});
// route to get all users
const usersRoute = app.get('/users', async (c) => {
const users = await prisma.user.findMany({
select: {
id: true,
username: true,
nickname: true,
createdAt: true,
},
});
return c.json(users);
});
const port = Number.parseInt(process.env.PORT || '3000');
console.log(`API server listening on port ${port}`);
// This exports the type of our app's routes,
// which the client can use for end-to-end type safety.
export type AppType = typeof usersRoute;
export default {
port: 3000,
fetch: app.fetch,
};

10
apps/api/tsconfig.json Normal file
View File

@@ -0,0 +1,10 @@
{
"extends": "@concord/tsconfig/base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"]
}