A progressive Node.js framework for building efficient and scalable server-side applications.
Fakeflix is a Netflix-like streaming platform built with NestJS, implementing both REST and GraphQL APIs. The project follows enterprise-grade architecture patterns with clear separation of concerns and modern development practices.
The application is built using:
- NestJS as the main framework
- Modular architecture with clear separation of concerns
- Dual API support (REST and GraphQL)
- Dual database setup (TypeORM and Prisma)
- Video content management (movies, TV shows, episodes)
- External movie rating integration (MovieDB API)
- Video uploads and thumbnails handling
- User authentication and authorization
- User account management
- JWT-based authentication
- Password hashing with bcrypt
- GraphQL API for user operations
- Prisma ORM for database interactions
- Payment processing
- Subscription management
- Drizzle ORM for database interactions
The project uses three separate schemas:
Identity Schema:
- User management
- Authentication data
- Managed with Prisma ORM
Content Schema:
- Movies
- TV Shows
- Episodes
- Videos
- Thumbnails
- Managed with TypeORM
Billing Schema:
- Payment information
- Subscription details
- Managed with Drizzle ORM
Backend:
- NestJS (Node.js framework)
- TypeScript
- GraphQL (Apollo Server)
- REST APIs
Databases:
- PostgreSQL
- Prisma (identity management)
- TypeORM (content management)
- Drizzle (billing management)
Testing:
- Jest
- E2E testing support
- Nock for HTTP mocking
Infrastructure:
- Docker (development database)
- Environment-based configuration
src/
├── module/
│ ├── content/ # Content management
│ ├── identity/ # User management
│ ├── billing/ # Billing management
│ └── shared/ # Shared modules and utilities
database/
├── content/ # Content database configurations
├── identity/ # Identity database configurations
└── billing/ # Billing database configurations
test/ # Test configurations and utilities
- Package Management: Yarn
- Node Version: 18.17.1
- Database: PostgreSQL 15 (via Docker)
- Testing: Jest with E2E support
- Code Quality: ESLint + Prettier
Recommend to use the --frozen-lockfile
flag
$ yarn --frozen-lockfile
- Node.js 18.17.1
- Docker and Docker Compose
- PostgreSQL 15
- Yarn package manager
- Copy the example environment file:
$ cp .env.example .env
- Configure and adjust your environment variables.
Start the development databases using Docker:
# Start all services
$ docker-compose up -d
# Start specific database
$ docker-compose up -d postgres
# Stop all services
$ docker-compose down
# View logs
$ docker-compose logs -f
- Start the Docker containers
- Run migrations for each database:
# Content database
$ yarn run content:db:migrate
# Identity database
$ yarn run identity:db:migrate
# Billing database
$ yarn run billing:db:migrate
The REST API documentation is available at:
- Swagger UI: http://localhost:3000/api
- OpenAPI JSON: http://localhost:3000/api-json
The GraphQL playground is available at:
GraphQL schema can be explored interactively in the playground.
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
# Content Database (TypeORM)
# Generate content database migrations
$ yarn run content:db:generate
# Run content database migrations
$ yarn run content:db:migrate
# Drop content database schema
$ yarn run content:db:drop
# Identity Database (Prisma)
# Generate identity database migrations
$ yarn run identity:db:generate
# Push identity database changes
$ yarn run identity:db:migrate
# Billing Database (Drizzle)
# Generate billing database migrations
$ yarn run billing:db:generate
# Run billing database migrations
$ yarn run billing:db:migrate
# Push billing database changes
$ yarn run billing:db:push
# Drop billing database schema
$ yarn run billing:db:drop
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.