Skip to main content

Backend API Setup

NestJS backend with PostgreSQL.

Prerequisites

  • Node.js v20 or higher
  • PostgreSQL v12 or higher
  • Redis v7 or higher
  • MinIO or S3-compatible storage

Steps

  1. Clone Backend Repository
git clone https://github.com/leyu-opensource-platform/leyu-backend.git
cd leyu-backend
  1. Clone Backend Repository Install Dependencies
npm install
  1. Configure Environment
cp .env.example .env

Edit .env with your configuration:

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/leyu_db"

# JWT
JWT_SECRET="your-secret-key"

# Redis
REDIS_URL="redis://localhost:6379"


4. **Setup Database**
```bash
# Run migrations
npm run migration:run

# Seed initial data
npm run seed
  1. Start the Server
npm run start:dev

API will be available at http://localhost:3000/api.

Test Account

Username: guest@gmail.com

Password: guest@1234