60 lines
1.3 KiB
Markdown
60 lines
1.3 KiB
Markdown
**GG-Node-Backend**
|
|
|
|
## Tech Stack
|
|
|
|
Runtime: Node.js (ES Modules)
|
|
Framework: Express.js (v5.x)
|
|
ORM: Prisma (PostgreSQL)
|
|
Storage: Bytescale (Image uploads)
|
|
Auth: JSON Web Tokens (JWT) & Bcrypt
|
|
Email: Postmark
|
|
|
|
## Project Structure
|
|
|
|
backend/
|
|
├── prisma/
|
|
│ └── schema.prisma
|
|
├──── src/
|
|
│ ├── app.js
|
|
│ ├── controllers/
|
|
│ ├── middlewares/
|
|
│ ├── routes/
|
|
│ ├── prisma/
|
|
│ └── utils/
|
|
├── .env
|
|
└── package.json
|
|
|
|
## Installation & Setup
|
|
|
|
**1. Prerequisites**
|
|
Node.js (v18+)
|
|
PostgreSQL Database
|
|
|
|
**2. Environment Variables**
|
|
DATABASE_URL=""
|
|
PORT=5008
|
|
JWT_SECRET=""
|
|
CORS_ALLOWED_ORIGINS=http://localhost:3001 http://localhost:3003 http://localhost:5174 http://localhost:5173
|
|
BYTESCALE_SECRET_API_KEY=""
|
|
POSTMARK_API_KEY=""
|
|
|
|
**3. Install Dependencies**
|
|
npm install
|
|
|
|
**4. Database Initialization**
|
|
|
|
# Generate Prisma Client
|
|
|
|
npm run generate
|
|
|
|
# Run migrations to create database tables
|
|
|
|
npm run migrate
|
|
|
|
## Scripts
|
|
|
|
1. npm start: Runs the server in production mode.
|
|
2. npm run migrate: Syncs your local database with the current Prisma schema.
|
|
3. npm run generate: Regenerates the Prisma Client (run this after schema changes).
|
|
4. npx prisma studio: Opens a visual editor to view and manage your database data.
|