Skip to content

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.

Notifications You must be signed in to change notification settings

IglanCardeal/enterprise-apps-classes

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Project Overview

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.

Architecture

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)

Main Modules

Content Module

  • Video content management (movies, TV shows, episodes)
  • External movie rating integration (MovieDB API)
  • Video uploads and thumbnails handling

Identity Module

  • User authentication and authorization
  • User account management
  • JWT-based authentication
  • Password hashing with bcrypt
  • GraphQL API for user operations
  • Prisma ORM for database interactions

Billing Module

  • Payment processing
  • Subscription management
  • Drizzle ORM for database interactions

Database Structure

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

Technical Stack

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

Project Structure

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

Development Tools

  • Package Management: Yarn
  • Node Version: 18.17.1
  • Database: PostgreSQL 15 (via Docker)
  • Testing: Jest with E2E support
  • Code Quality: ESLint + Prettier

Installation

Recommend to use the --frozen-lockfile flag

$ yarn --frozen-lockfile

Getting Started

Prerequisites

  • Node.js 18.17.1
  • Docker and Docker Compose
  • PostgreSQL 15
  • Yarn package manager

Environment Setup

  1. Copy the example environment file:
$ cp .env.example .env
  1. Configure and adjust your environment variables.

Docker Setup

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

Database Setup

  1. Start the Docker containers
  2. 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

API Documentation

REST API

The REST API documentation is available at:

GraphQL API

The GraphQL playground is available at:

GraphQL schema can be explored interactively in the playground.

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Database Management

# 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

Support

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.

Stay in touch

License

Nest is MIT licensed.

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published