oauth_nest_demo/README.md

2.4 KiB

OAuth NestJS Demo

A NestJS backend with multi-provider OAuth, JWT authentication, task management, and a license/activation key system.

Tech Stack

  • Framework: NestJS 10 + TypeScript
  • Database: MySQL + TypeORM
  • Auth: JWT, GitHub OAuth2, Lark OAuth2
  • API Docs: Swagger (/api)
  • Package Manager: pnpm

Getting Started

# Install dependencies
pnpm install

# Configure environment variables
cp .env.example .env  # then edit .env

# Start in development mode
pnpm run start:dev

See docs/QUICKSTART.md for a detailed setup guide.

Documentation

Document Description
QUICKSTART.md Quick start guide
OAuth-JWT-Integration.md OAuth and JWT integration
database-flow.md Database schema and data flow
LICENSE_SYSTEM.md License system overview
LICENSE_IMPLEMENTATION.md License implementation details
GENERATE_LICENSE_GUIDE.md License generation guide
HOW_TO_GENERATE.md License generation instructions

Scripts

Script Description
scripts/generate-licenses.sh Interactive license key generation
scripts/test-license-system.sh License system integration tests
scripts/check-db-schema.js Database schema validation
# Generate license keys
bash scripts/generate-licenses.sh

# Run license system tests
bash scripts/test-license-system.sh

Running the App

# Development
pnpm run start:dev

# Production build
pnpm run build
pnpm run start:prod

Tests

# Unit tests
pnpm run test

# E2E tests
pnpm run test:e2e

# Coverage
pnpm run test:cov

Project Structure

src/
├── auth/          # JWT auth, strategies, guards
├── common/        # Shared filters, interceptors, guards
├── user/          # User management
├── task/          # Task management
├── license/       # License/activation key system
├── github/        # GitHub OAuth provider
├── lark/          # Lark OAuth provider
├── deepseek/      # DeepSeek AI provider
└── constants/     # Shared constants
docs/              # Project documentation
scripts/           # Utility and test scripts
test/              # E2E tests