97 lines
2.4 KiB
Markdown
97 lines
2.4 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
# 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](docs/QUICKSTART.md) for a detailed setup guide.
|
|
|
|
## Documentation
|
|
|
|
| Document | Description |
|
|
| --- | --- |
|
|
| [QUICKSTART.md](docs/QUICKSTART.md) | Quick start guide |
|
|
| [OAuth-JWT-Integration.md](docs/OAuth-JWT-Integration.md) | OAuth and JWT integration |
|
|
| [database-flow.md](docs/database-flow.md) | Database schema and data flow |
|
|
| [LICENSE_SYSTEM.md](docs/LICENSE_SYSTEM.md) | License system overview |
|
|
| [LICENSE_IMPLEMENTATION.md](docs/LICENSE_IMPLEMENTATION.md) | License implementation details |
|
|
| [GENERATE_LICENSE_GUIDE.md](docs/GENERATE_LICENSE_GUIDE.md) | License generation guide |
|
|
| [HOW_TO_GENERATE.md](docs/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 |
|
|
|
|
```bash
|
|
# Generate license keys
|
|
bash scripts/generate-licenses.sh
|
|
|
|
# Run license system tests
|
|
bash scripts/test-license-system.sh
|
|
```
|
|
|
|
## Running the App
|
|
|
|
```bash
|
|
# Development
|
|
pnpm run start:dev
|
|
|
|
# Production build
|
|
pnpm run build
|
|
pnpm run start:prod
|
|
```
|
|
|
|
## Tests
|
|
|
|
```bash
|
|
# Unit tests
|
|
pnpm run test
|
|
|
|
# E2E tests
|
|
pnpm run test:e2e
|
|
|
|
# Coverage
|
|
pnpm run test:cov
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```text
|
|
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
|
|
```
|