Created Frontend and backend server and using claude to deploy db.ts and env.ts
This commit is contained in:
9
Phase.txt
Normal file
9
Phase.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
1. Project setup — backend init, MongoDB connect, folder structure
|
||||||
|
2. User model + Register/Login endpoints + JWT
|
||||||
|
3. Todo model + full CRUD endpoints + middleware
|
||||||
|
4. React project setup + routing + Tailwind
|
||||||
|
5. Auth UI (Login/Register forms, AuthContext)
|
||||||
|
6. Todo UI (list, create, update, delete, toggle)
|
||||||
|
7. Filtering, priority, due dates
|
||||||
|
8. Polish — responsive design, UX details
|
||||||
|
9. Polish — responsive design, UX details
|
||||||
2090
server/package-lock.json
generated
Normal file
2090
server/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
32
server/package.json
Normal file
32
server/package.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "server",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "ts-node-dev --respawn --transpile-only src/server.ts",
|
||||||
|
"build": "tsc",
|
||||||
|
"start": "node dist/server.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"type": "commonjs",
|
||||||
|
"dependencies": {
|
||||||
|
"bcryptjs": "^3.0.3",
|
||||||
|
"cors": "^2.8.6",
|
||||||
|
"dotenv": "^17.4.2",
|
||||||
|
"express": "^5.2.1",
|
||||||
|
"jsonwebtoken": "^9.0.3",
|
||||||
|
"mongoose": "^9.4.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/bcryptjs": "^2.4.6",
|
||||||
|
"@types/cors": "^2.8.19",
|
||||||
|
"@types/express": "^5.0.6",
|
||||||
|
"@types/jsonwebtoken": "^9.0.10",
|
||||||
|
"@types/node": "^25.6.0",
|
||||||
|
"ts-node-dev": "^2.0.0",
|
||||||
|
"typescript": "^6.0.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
0
server/src/config/db.ts
Normal file
0
server/src/config/db.ts
Normal file
21
server/src/config/env.ts
Normal file
21
server/src/config/env.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import dotenv from "dotenv"
|
||||||
|
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
|
||||||
|
// This function validates that required env vars exist at startup
|
||||||
|
// Your app crashes immediately with a clear message — not silently later
|
||||||
|
const getEnvVar = (key: string): string => {
|
||||||
|
const value = process.env[key];
|
||||||
|
if (!value) {
|
||||||
|
throw new Error(`Missing required Environment Variable: ${key}`)
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ENV = {
|
||||||
|
PORT: process.env.PORT || '5000',
|
||||||
|
MONGO_URI: getEnvVar('MONGO_URI'),
|
||||||
|
JWT_SECRET: getEnvVar('JWT_SECRET'),
|
||||||
|
NODE_ENV: process.env.NODE_ENV || 'development',
|
||||||
|
}
|
||||||
17
server/tsconfig.json
Normal file
17
server/tsconfig.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// server/tsconfig.json
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "commonjs",
|
||||||
|
"lib": ["ES2020"],
|
||||||
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"resolveJsonModule": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"],
|
||||||
|
"exclude": ["node_modules", "dist"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user