Understanding the project structure is the first step to effectively building on top of LaunchKit AWS. The boilerplate is organized into distinct, logical sections to ensure a clean separation of concerns and make the codebase easy to navigate. Think of it as a monorepo contained within a single repository, with clear boundaries between the frontend application, the backend infrastructure, and the database schema.

Root Directory

At the root of the project, you’ll find standard configuration files:
  • package.json: Defines project scripts and frontend dependencies.
  • .env.example: A template for all required environment variables.
  • docker-compose.yml: Defines the local Postgres database service.
  • next.config.js: Configuration for the Next.js frontend.
  • tailwind.config.ts: Configuration for the Tailwind CSS utility framework.
  • prisma/: Contains the database schema and configuration.
  • cdk/: Contains all the AWS CDK infrastructure code.

The Frontend Application (/app)

The core of your user-facing application lives here. This is a standard Next.js 14+ application using the App Router.
  • /app: Contains all your routes, pages, and layouts. This is where you’ll spend most of your time building UI.
  • /components: Home to all reusable React components, organized by feature or type.
  • /lib: A place for shared utility functions, helper scripts, and custom hooks used across the frontend.
  • /public: For static assets like images, fonts, and favicons.

The Backend Infrastructure (/cdk)

This directory contains all the code for your application’s infrastructure, defined using the AWS Cloud Development Kit (CDK). When you run yarn deploy:prod, the code in this directory is what provisions your resources on AWS.
  • /cdk/package.json: Defines the dependencies specifically for your CDK infrastructure (e.g., aws-cdk, aws-cdk-lib).
  • /cdk/bin/cdk.ts: The entrypoint for the CDK application. It instantiates your main infrastructure stack.
  • /cdk/lib/NextJsServerlessStack.ts: The heart of your infrastructure. This file defines all the AWS stack for your application, including the necessary resources for the Next.js app (CloudFront, S3, Lambda).

The Database Schema (/prisma)

All aspects of your database are managed in this directory using Prisma.
  • /prisma/schema.prisma: This is the single source of truth for your database schema. You define your data models here (e.g., User, Team, Subscription), and Prisma uses this file to generate migrations and the type-safe database client.
  • /prisma/migrations: Prisma automatically generates and stores your database migration history here.
This separation ensures that your application logic, infrastructure, and data schema are all independently manageable but work together seamlessly. """