create-nene 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +87 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/default/.cursor/rules/backend-patterns.mdc +68 -0
- package/templates/default/.cursor/rules/frontend-patterns.mdc +53 -0
- package/templates/default/.cursor/rules/nene-architecture.mdc +65 -0
- package/templates/default/.cursor/rules/shared-package.mdc +68 -0
- package/templates/default/.cursor/rules/task-management.mdc +60 -0
- package/templates/default/README.md +42 -25
- package/templates/default/_gitignore +10 -17
- package/templates/default/apps/api/nest-cli.json +8 -0
- package/templates/default/apps/api/package.json +36 -0
- package/templates/default/apps/api/src/app.controller.ts +12 -0
- package/templates/default/apps/api/src/app.module.ts +19 -0
- package/templates/default/apps/api/src/app.service.ts +8 -0
- package/templates/default/apps/api/src/config/configuration.ts +6 -0
- package/templates/default/apps/api/src/health/health.controller.ts +12 -0
- package/templates/default/apps/api/src/health/health.module.ts +9 -0
- package/templates/default/apps/api/src/health/health.service.ts +12 -0
- package/templates/default/apps/api/src/main.ts +32 -0
- package/templates/default/apps/api/tsconfig.json +26 -0
- package/templates/default/apps/web/next.config.ts +7 -0
- package/templates/default/apps/web/package.json +28 -0
- package/templates/default/apps/web/postcss.config.mjs +9 -0
- package/templates/default/apps/web/src/app/globals.css +20 -0
- package/templates/default/apps/web/src/app/layout.tsx +19 -0
- package/templates/default/apps/web/src/app/page.tsx +75 -0
- package/templates/default/apps/web/tailwind.config.ts +15 -0
- package/templates/default/{tsconfig.json → apps/web/tsconfig.json} +11 -8
- package/templates/default/docs/API.md +55 -0
- package/templates/default/docs/ARCHITECTURE.md +56 -0
- package/templates/default/docs/PROGRESS.md +40 -0
- package/templates/default/package.json +12 -17
- package/templates/default/packages/shared/package.json +29 -0
- package/templates/default/packages/shared/src/constants/index.ts +13 -0
- package/templates/default/packages/shared/src/index.ts +3 -0
- package/templates/default/packages/shared/src/types/index.ts +21 -0
- package/templates/default/packages/shared/tsconfig.json +17 -0
- package/templates/default/packages/shared/tsup.config.ts +10 -0
- package/templates/default/pnpm-workspace.yaml +3 -0
- package/templates/default/turbo.json +14 -0
- package/templates/default/eslint.config.mjs +0 -10
- package/templates/default/src/app/layout.tsx +0 -14
- package/templates/default/src/app/page.tsx +0 -29
- package/templates/default/src/server/api/hello.ts +0 -14
- package/templates/default/src/server/index.ts +0 -3
- package/templates/minimal/README.md +0 -11
- package/templates/minimal/_gitignore +0 -6
- package/templates/minimal/package.json +0 -22
- package/templates/minimal/src/app/layout.tsx +0 -9
- package/templates/minimal/src/app/page.tsx +0 -7
- package/templates/minimal/tsconfig.json +0 -19
|
@@ -1,43 +1,60 @@
|
|
|
1
1
|
# My Nene App
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A full-stack monorepo with Next.js frontend and NestJS backend.
|
|
4
|
+
|
|
5
|
+
## Project Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
├── apps/
|
|
9
|
+
│ ├── web/ # Next.js frontend (port 3000)
|
|
10
|
+
│ └── api/ # NestJS backend (port 4000)
|
|
11
|
+
├── packages/
|
|
12
|
+
│ └── shared/ # Shared types, DTOs, utilities
|
|
13
|
+
└── docs/ # Project documentation
|
|
14
|
+
```
|
|
4
15
|
|
|
5
16
|
## Getting Started
|
|
6
17
|
|
|
7
|
-
|
|
18
|
+
### Prerequisites
|
|
19
|
+
|
|
20
|
+
- Node.js 18+
|
|
21
|
+
- pnpm 9+
|
|
22
|
+
|
|
23
|
+
### Installation
|
|
8
24
|
|
|
9
25
|
```bash
|
|
10
|
-
|
|
11
|
-
# or
|
|
12
|
-
yarn dev
|
|
13
|
-
# or
|
|
14
|
-
pnpm dev
|
|
26
|
+
pnpm install
|
|
15
27
|
```
|
|
16
28
|
|
|
17
|
-
|
|
29
|
+
### Development
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
Run both frontend and backend:
|
|
20
32
|
|
|
33
|
+
```bash
|
|
34
|
+
pnpm dev
|
|
21
35
|
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
│ └── server/ # Backend API and services
|
|
28
|
-
│ └── api/ # API routes
|
|
29
|
-
├── public/ # Static assets
|
|
30
|
-
├── package.json
|
|
31
|
-
└── tsconfig.json
|
|
36
|
+
|
|
37
|
+
Run only frontend:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm dev:web
|
|
32
41
|
```
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
Run only backend:
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
```bash
|
|
46
|
+
pnpm dev:api
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Build
|
|
37
50
|
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
```bash
|
|
52
|
+
pnpm build
|
|
53
|
+
```
|
|
40
54
|
|
|
41
|
-
##
|
|
55
|
+
## Tech Stack
|
|
42
56
|
|
|
43
|
-
|
|
57
|
+
- **Frontend**: Next.js 15, React 19, Tailwind CSS
|
|
58
|
+
- **Backend**: NestJS 11, class-validator
|
|
59
|
+
- **Shared**: TypeScript, shared types and DTOs
|
|
60
|
+
- **Tooling**: Turborepo, pnpm workspaces
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
# Dependencies
|
|
2
|
-
node_modules
|
|
3
|
-
.
|
|
4
|
-
.pnp.js
|
|
2
|
+
node_modules
|
|
3
|
+
.pnpm-store
|
|
5
4
|
|
|
6
|
-
# Build
|
|
7
|
-
dist
|
|
8
|
-
.
|
|
9
|
-
.
|
|
10
|
-
out/
|
|
5
|
+
# Build outputs
|
|
6
|
+
dist
|
|
7
|
+
.next
|
|
8
|
+
.turbo
|
|
11
9
|
|
|
12
10
|
# Environment
|
|
13
11
|
.env
|
|
@@ -15,8 +13,8 @@ out/
|
|
|
15
13
|
.env.*.local
|
|
16
14
|
|
|
17
15
|
# IDE
|
|
18
|
-
.idea
|
|
19
|
-
.vscode
|
|
16
|
+
.idea
|
|
17
|
+
.vscode
|
|
20
18
|
*.swp
|
|
21
19
|
*.swo
|
|
22
20
|
|
|
@@ -27,15 +25,10 @@ Thumbs.db
|
|
|
27
25
|
# Logs
|
|
28
26
|
*.log
|
|
29
27
|
npm-debug.log*
|
|
30
|
-
yarn-debug.log*
|
|
31
|
-
yarn-error.log*
|
|
32
28
|
pnpm-debug.log*
|
|
33
29
|
|
|
34
30
|
# Testing
|
|
35
|
-
coverage
|
|
36
|
-
|
|
37
|
-
# TypeScript
|
|
38
|
-
*.tsbuildinfo
|
|
31
|
+
coverage
|
|
39
32
|
|
|
40
33
|
# Misc
|
|
41
|
-
|
|
34
|
+
*.tsbuildinfo
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@app/api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "nest start --watch",
|
|
7
|
+
"build": "nest build",
|
|
8
|
+
"start": "node dist/main",
|
|
9
|
+
"start:prod": "node dist/main",
|
|
10
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
11
|
+
"test": "jest",
|
|
12
|
+
"test:watch": "jest --watch"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@app/shared": "workspace:*",
|
|
16
|
+
"@nestjs/common": "^11.0.0",
|
|
17
|
+
"@nestjs/config": "^4.0.0",
|
|
18
|
+
"@nestjs/core": "^11.0.0",
|
|
19
|
+
"@nestjs/platform-express": "^11.0.0",
|
|
20
|
+
"class-transformer": "^0.5.1",
|
|
21
|
+
"class-validator": "^0.14.1",
|
|
22
|
+
"reflect-metadata": "^0.2.2",
|
|
23
|
+
"rxjs": "^7.8.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@nestjs/cli": "^11.0.0",
|
|
27
|
+
"@nestjs/schematics": "^11.0.0",
|
|
28
|
+
"@nestjs/testing": "^11.0.0",
|
|
29
|
+
"@types/express": "^5.0.0",
|
|
30
|
+
"@types/node": "^22.0.0",
|
|
31
|
+
"ts-loader": "^9.5.1",
|
|
32
|
+
"ts-node": "^10.9.2",
|
|
33
|
+
"tsconfig-paths": "^4.2.0",
|
|
34
|
+
"typescript": "^5.7.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Controller, Get } from '@nestjs/common';
|
|
2
|
+
import { AppService } from './app.service';
|
|
3
|
+
|
|
4
|
+
@Controller()
|
|
5
|
+
export class AppController {
|
|
6
|
+
constructor(private readonly appService: AppService) {}
|
|
7
|
+
|
|
8
|
+
@Get()
|
|
9
|
+
getHello(): string {
|
|
10
|
+
return this.appService.getHello();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { ConfigModule } from '@nestjs/config';
|
|
3
|
+
import { AppController } from './app.controller';
|
|
4
|
+
import { AppService } from './app.service';
|
|
5
|
+
import { HealthModule } from './health/health.module';
|
|
6
|
+
import configuration from './config/configuration';
|
|
7
|
+
|
|
8
|
+
@Module({
|
|
9
|
+
imports: [
|
|
10
|
+
ConfigModule.forRoot({
|
|
11
|
+
isGlobal: true,
|
|
12
|
+
load: [configuration],
|
|
13
|
+
}),
|
|
14
|
+
HealthModule,
|
|
15
|
+
],
|
|
16
|
+
controllers: [AppController],
|
|
17
|
+
providers: [AppService],
|
|
18
|
+
})
|
|
19
|
+
export class AppModule {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Controller, Get } from '@nestjs/common';
|
|
2
|
+
import { HealthService } from './health.service';
|
|
3
|
+
|
|
4
|
+
@Controller('health')
|
|
5
|
+
export class HealthController {
|
|
6
|
+
constructor(private readonly healthService: HealthService) {}
|
|
7
|
+
|
|
8
|
+
@Get()
|
|
9
|
+
check() {
|
|
10
|
+
return this.healthService.check();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { HealthController } from './health.controller';
|
|
3
|
+
import { HealthService } from './health.service';
|
|
4
|
+
|
|
5
|
+
@Module({
|
|
6
|
+
controllers: [HealthController],
|
|
7
|
+
providers: [HealthService],
|
|
8
|
+
})
|
|
9
|
+
export class HealthModule {}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NestFactory } from '@nestjs/core';
|
|
2
|
+
import { ValidationPipe } from '@nestjs/common';
|
|
3
|
+
import { AppModule } from './app.module';
|
|
4
|
+
|
|
5
|
+
async function bootstrap() {
|
|
6
|
+
const app = await NestFactory.create(AppModule);
|
|
7
|
+
|
|
8
|
+
// Enable CORS for frontend
|
|
9
|
+
app.enableCors({
|
|
10
|
+
origin: process.env.FRONTEND_URL || 'http://localhost:3000',
|
|
11
|
+
credentials: true,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Global validation pipe
|
|
15
|
+
app.useGlobalPipes(
|
|
16
|
+
new ValidationPipe({
|
|
17
|
+
whitelist: true,
|
|
18
|
+
forbidNonWhitelisted: true,
|
|
19
|
+
transform: true,
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// Global prefix for API routes
|
|
24
|
+
app.setGlobalPrefix('api');
|
|
25
|
+
|
|
26
|
+
const port = process.env.PORT || 4000;
|
|
27
|
+
await app.listen(port);
|
|
28
|
+
|
|
29
|
+
console.log(`API server running on http://localhost:${port}`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
bootstrap();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"removeComments": true,
|
|
6
|
+
"emitDecoratorMetadata": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"target": "ES2021",
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"incremental": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"strictNullChecks": true,
|
|
16
|
+
"noImplicitAny": true,
|
|
17
|
+
"strictBindCallApply": true,
|
|
18
|
+
"forceConsistentCasingInFileNames": true,
|
|
19
|
+
"noFallthroughCasesInSwitch": true,
|
|
20
|
+
"paths": {
|
|
21
|
+
"@/*": ["src/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["src/**/*"],
|
|
25
|
+
"exclude": ["node_modules", "dist"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@app/web",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"lint": "eslint ."
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@app/shared": "workspace:*",
|
|
13
|
+
"next": "^15.0.0",
|
|
14
|
+
"react": "^19.0.0",
|
|
15
|
+
"react-dom": "^19.0.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.0.0",
|
|
19
|
+
"@types/react": "^19.0.0",
|
|
20
|
+
"@types/react-dom": "^19.0.0",
|
|
21
|
+
"autoprefixer": "^10.4.20",
|
|
22
|
+
"eslint": "^9.0.0",
|
|
23
|
+
"eslint-config-next": "^15.0.0",
|
|
24
|
+
"postcss": "^8.4.49",
|
|
25
|
+
"tailwindcss": "^3.4.15",
|
|
26
|
+
"typescript": "^5.7.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--foreground-rgb: 0, 0, 0;
|
|
7
|
+
--background-rgb: 255, 255, 255;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@media (prefers-color-scheme: dark) {
|
|
11
|
+
:root {
|
|
12
|
+
--foreground-rgb: 255, 255, 255;
|
|
13
|
+
--background-rgb: 10, 10, 10;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
body {
|
|
18
|
+
color: rgb(var(--foreground-rgb));
|
|
19
|
+
background: rgb(var(--background-rgb));
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
import './globals.css';
|
|
3
|
+
|
|
4
|
+
export const metadata: Metadata = {
|
|
5
|
+
title: 'My Nene App',
|
|
6
|
+
description: 'A full-stack app built with Next.js and NestJS',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default function RootLayout({
|
|
10
|
+
children,
|
|
11
|
+
}: {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<html lang="en">
|
|
16
|
+
<body>{children}</body>
|
|
17
|
+
</html>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { API_ROUTES } from '@app/shared';
|
|
5
|
+
|
|
6
|
+
interface HealthStatus {
|
|
7
|
+
status: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
uptime: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function Home() {
|
|
13
|
+
const [health, setHealth] = useState<HealthStatus | null>(null);
|
|
14
|
+
const [error, setError] = useState<string | null>(null);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const checkHealth = async () => {
|
|
18
|
+
try {
|
|
19
|
+
const res = await fetch(`http://localhost:4000${API_ROUTES.HEALTH}`);
|
|
20
|
+
const data = await res.json();
|
|
21
|
+
setHealth(data);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
setError('API server is not running');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
checkHealth();
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<main className="flex min-h-screen flex-col items-center justify-center p-24">
|
|
32
|
+
<h1 className="text-4xl font-bold mb-8">Welcome to nene.js</h1>
|
|
33
|
+
<p className="text-lg text-gray-600 mb-8">
|
|
34
|
+
A full-stack monorepo with Next.js and NestJS
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
<div className="bg-gray-100 dark:bg-gray-800 rounded-lg p-6 w-full max-w-md">
|
|
38
|
+
<h2 className="text-xl font-semibold mb-4">API Health Check</h2>
|
|
39
|
+
{error ? (
|
|
40
|
+
<p className="text-red-500">{error}</p>
|
|
41
|
+
) : health ? (
|
|
42
|
+
<div className="space-y-2">
|
|
43
|
+
<p>
|
|
44
|
+
Status:{' '}
|
|
45
|
+
<span className="text-green-500 font-medium">{health.status}</span>
|
|
46
|
+
</p>
|
|
47
|
+
<p className="text-sm text-gray-500">
|
|
48
|
+
Uptime: {Math.floor(health.uptime)}s
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
) : (
|
|
52
|
+
<p className="text-gray-500">Checking...</p>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div className="mt-12 grid grid-cols-2 gap-4 text-center">
|
|
57
|
+
<a
|
|
58
|
+
href="http://localhost:4000/api"
|
|
59
|
+
target="_blank"
|
|
60
|
+
className="p-4 border rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800"
|
|
61
|
+
>
|
|
62
|
+
<h3 className="font-semibold">API Server</h3>
|
|
63
|
+
<p className="text-sm text-gray-500">localhost:4000</p>
|
|
64
|
+
</a>
|
|
65
|
+
<a
|
|
66
|
+
href="/docs"
|
|
67
|
+
className="p-4 border rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800"
|
|
68
|
+
>
|
|
69
|
+
<h3 className="font-semibold">Documentation</h3>
|
|
70
|
+
<p className="text-sm text-gray-500">View docs</p>
|
|
71
|
+
</a>
|
|
72
|
+
</div>
|
|
73
|
+
</main>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Config } from 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
const config: Config = {
|
|
4
|
+
content: [
|
|
5
|
+
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
|
|
6
|
+
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
|
|
7
|
+
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
|
|
8
|
+
],
|
|
9
|
+
theme: {
|
|
10
|
+
extend: {},
|
|
11
|
+
},
|
|
12
|
+
plugins: [],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default config;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"lib": ["dom", "dom.iterable", "
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
5
|
"allowJs": true,
|
|
6
6
|
"skipLibCheck": true,
|
|
7
7
|
"strict": true,
|
|
8
8
|
"noEmit": true,
|
|
9
9
|
"esModuleInterop": true,
|
|
10
|
-
"module": "
|
|
10
|
+
"module": "esnext",
|
|
11
11
|
"moduleResolution": "bundler",
|
|
12
12
|
"resolveJsonModule": true,
|
|
13
13
|
"isolatedModules": true,
|
|
14
|
-
"jsx": "
|
|
14
|
+
"jsx": "preserve",
|
|
15
15
|
"incremental": true,
|
|
16
|
-
"
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
17
21
|
"paths": {
|
|
18
|
-
"@/*": ["./src/*"]
|
|
19
|
-
"@server/*": ["./src/server/*"]
|
|
22
|
+
"@/*": ["./src/*"]
|
|
20
23
|
}
|
|
21
24
|
},
|
|
22
|
-
"include": ["
|
|
25
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
23
26
|
"exclude": ["node_modules"]
|
|
24
27
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## Base URL
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
http://localhost:4000/api
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Endpoints
|
|
10
|
+
|
|
11
|
+
### Health Check
|
|
12
|
+
|
|
13
|
+
#### GET /api/health
|
|
14
|
+
|
|
15
|
+
Check if the API server is running.
|
|
16
|
+
|
|
17
|
+
**Response:**
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"status": "ok",
|
|
21
|
+
"timestamp": "2024-01-01T00:00:00.000Z",
|
|
22
|
+
"uptime": 123.456
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Root
|
|
27
|
+
|
|
28
|
+
#### GET /api
|
|
29
|
+
|
|
30
|
+
Returns a welcome message.
|
|
31
|
+
|
|
32
|
+
**Response:**
|
|
33
|
+
```
|
|
34
|
+
Welcome to the API!
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Error Handling
|
|
38
|
+
|
|
39
|
+
All errors follow this format:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"statusCode": 400,
|
|
44
|
+
"message": "Error description",
|
|
45
|
+
"error": "Bad Request"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Authentication
|
|
50
|
+
|
|
51
|
+
(To be implemented)
|
|
52
|
+
|
|
53
|
+
## Rate Limiting
|
|
54
|
+
|
|
55
|
+
(To be implemented)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
This document describes the architecture of this project for AI agents and developers.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This is a full-stack monorepo with:
|
|
8
|
+
- **Frontend**: Next.js 15 with React 19
|
|
9
|
+
- **Backend**: NestJS 11 with class-validator
|
|
10
|
+
- **Shared**: TypeScript types and constants
|
|
11
|
+
|
|
12
|
+
## Project Structure
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
├── apps/
|
|
16
|
+
│ ├── web/ # Next.js frontend
|
|
17
|
+
│ │ ├── src/app/ # App router pages
|
|
18
|
+
│ │ └── src/ # Components, hooks, utils
|
|
19
|
+
│ └── api/ # NestJS backend
|
|
20
|
+
│ └── src/ # Modules, controllers, services
|
|
21
|
+
├── packages/
|
|
22
|
+
│ └── shared/ # Shared types and constants
|
|
23
|
+
│ └── src/
|
|
24
|
+
│ ├── types/ # TypeScript interfaces
|
|
25
|
+
│ └── constants/# API routes, constants
|
|
26
|
+
└── docs/ # Project documentation
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Data Flow
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
[Browser] <--HTTP--> [Next.js :3000] <--HTTP--> [NestJS :4000] <---> [Database]
|
|
33
|
+
| |
|
|
34
|
+
+---- @app/shared --------+
|
|
35
|
+
(types, constants)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Key Patterns
|
|
39
|
+
|
|
40
|
+
### API Communication
|
|
41
|
+
- Frontend calls backend via REST API
|
|
42
|
+
- Shared types ensure type safety across the stack
|
|
43
|
+
- API routes defined in `@app/shared/constants`
|
|
44
|
+
|
|
45
|
+
### Validation
|
|
46
|
+
- Backend uses class-validator for request validation
|
|
47
|
+
- DTOs can be shared between frontend and backend
|
|
48
|
+
|
|
49
|
+
### Configuration
|
|
50
|
+
- Backend uses @nestjs/config for environment management
|
|
51
|
+
- Frontend uses Next.js environment variables
|
|
52
|
+
|
|
53
|
+
## Ports
|
|
54
|
+
|
|
55
|
+
- Frontend (web): http://localhost:3000
|
|
56
|
+
- Backend (api): http://localhost:4000
|