Skip to content

Saapless Fullstack Monorepo Starter

License

saapless/fullstack-monorepo-starter

Repository files navigation

Saapless Fullstack Monorepo Starter

Everything you need to get started building your next big project.

Features

  • Turborepo: For orchestrating tasks across multiple packages and apps.
  • TypeScript: Ensures static type safety across the project.
  • ESLint & Prettier: Maintain clean and consistent code formatting.
  • Husky & Commitlint: Pre-commit hooks and git message linting for standardized commits.
  • Jest & Playwright: Provides unit and end-to-end testing support.
  • AWS CDK: Deploy and manage AWS infrastructure for serverless applications.
  • Next.js: Build modern web applications with React and server-side rendering.

Table of Contents

What's Inside?

Folder Structure

  • /apps - Front-end clients reside here.
  • /apis - APIs and backend services.
  • /packages - Shared libraries, configuration files, and scripts.
  • /e2e - End-to-end tests setup and configurations.

Getting Started

  1. Click on Use this template in the top right corner.

  2. Select Create a new repository.

  3. Create your repository.

  4. Clone the repository locally for development:

    git clone https://github.com/yourusername/your-repo-name.git
    cd your-repo-name
  5. Set up your environment variables:

    Create a .env file in the root of the project based on the .env.example file provided. You can do this by running:

    cp .env.example .env
  6. Modify the values in the .env file to match your local and cloud environment:

    • STAGE: Set the project stage (e.g., dev, prod).
    • REGION: Specify the AWS region (e.g., eu-central-1).
    • AWS_PROFILE (optional): Set the AWS profile to use if you have multiple profiles configured locally.
    • REPOSITORY: Provide the URL of the GitHub repository.
    • BRANCH: Set the GitHub branch used for Amplify hosting.
    • GITHUB_TOKEN: Add your GitHub personal access token for repository access during deployments.
    • APP_URL: Set the front-end app URL for use in end-to-end tests (default is http://localhost:3000).
  7. Install the project dependencies:

    npm install
  8. Start the development server:

    npm run dev
  9. Your app should now be running locally!

Local Development

  1. Install the project dependencies:

    npm install
  2. Start the development server:

    npm run dev
  3. Your app should now be running locally!

Tests

This project supports both unit tests and end-to-end tests:

  • Unit tests are written using Jest.
  • End-to-end tests are written using Playwright.

Running Tests

  • To run unit tests:

    npm run test
  • To run end-to-end tests:

    npm run test:e2e

Deployment

Deploy from Local

Before deploying, ensure your AWS & Serverless Framework credentials are configured locally.

To deploy the infrastructure locally, run:

npm run deploy

Note: Your front-end app is hosted via Amplify Hosting. Deploying the infrastructure will only create the resources, in order to deploy the code you need to push your changes to the branch you provided via BRANCH env var.

Deploy via Github Actions

The repository includes a CI/CD setup via GitHub Actions, allowing for:

  • Manual deployment triggers.
  • Running end-to-end tests as part of the deployment pipeline.

Resources

Here are some helpful links to documentation and tools used in this monorepo starter:

License

Copyright (c) 2024 Saapless

This software is licensed under the MIT License. For more details, refer to the full LICENSE file.