/improved-octo-fortnight

A monorepo technical test project using Turborepo, featuring a full-stack application with Express.js backend and Next.js frontend.

Primary LanguageTypeScriptMIT LicenseMIT

improved-octo-fortnight

A monorepo technical test project using Turborepo, featuring a full-stack application with Express.js backend and Next.js frontend.

Project Structure

The project uses Turborepo and contains:

.github
  └─ workflows
        └─ CI with pnpm cache setup
.vscode
  └─ Recommended extensions and settings for VSCode users
apps
  ├─ backend-repo
  |   ├─ Express.js
  |   ├─ Firebase Admin SDK
  |   ├─ Jest for testing
  |   └─ TypeScript
  └─ frontend-repo
      ├─ Next.js
      ├─ React
      ├─ MUI Theme Customization
      ├─ Firebase Authentication
      ├─ Redux Store
      └─ Jest for testing
packages
  └─ types
      └─ Shared TypeScript types for API responses and user models

Key Features

Backend (apps/backend-repo)

  • Express.js server with TypeScript
  • Firebase Admin SDK integration
  • Authentication middleware
  • User routes and controllers
  • Integration and unit tests with Jest
  • Clean architecture with separate controllers, routes, and repositories

Frontend (apps/frontend-repo)

  • Next.js application
  • Material-UI with custom theme
  • Firebase Authentication
  • Redux store management
  • Custom hooks for user session and data
  • Component-based architecture (atoms/molecules)
  • Unit tests with Jest and Snapshots
  • Service worker for auth handling

Shared Types (packages/types)

  • Common TypeScript interfaces
  • API response types
  • User model definitions

Shared Utils (packages/utils)

  • Common utility functions
  • Err

Installation

Prerequisites

  • Node.js (version specified in .node-version)
  • pnpm package manager

Setup

  1. Clone the repository:
git clone https://github.com/ImBIOS/improved-octo-fortnight.git
cd improved-octo-fortnight
  1. Install dependencies:
pnpm install
  1. Set up environment variables:
# For backend
cp apps/backend-repo/.env.example apps/backend-repo/.env
# For frontend
cp apps/frontend-repo/.env.example apps/frontend-repo/.env
  1. Configure Firebase:
    • Create a Firebase project
    • Set up Firebase Admin SDK for backend
    • Configure Firebase Authentication for frontend
    • Update Firebase configuration in respective .env files

Development

  1. Start the backend server:
cd apps/backend-repo
pnpm dev
  1. Start the frontend application:
cd apps/frontend-repo
pnpm dev

Testing

The project includes comprehensive test suites for both backend and frontend:

# Run backend tests
cd apps/backend-repo
pnpm test

# Run frontend tests
cd apps/frontend-repo
pnpm test

Deployment

Backend Deployment

  1. Build the backend:
cd apps/backend-repo
pnpm build
  1. Deploy to your preferred hosting service (e.g., Google Cloud Run, Heroku)
  2. Set up environment variables in your hosting platform

Frontend Deployment

  1. Build the frontend:
cd apps/frontend-repo
pnpm build
  1. Deploy to your preferred hosting service (e.g., Vercel, Netlify)
  2. Configure environment variables in your hosting platform

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.