Skip to content

Getting Started

Welcome to the Coastal Element AI SDR Backend — a monorepo for managing the microservices and packages that power the AI SDR platform.

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (version 18.0.0 or higher)
  • pnpm (version 9.6.0 or higher)

Installation

  1. Clone the repository:

    bash
    git clone <your-repository-url> coastal-element-ai-backend
    cd coastal-element-ai-backend
  2. Install dependencies:

    bash
    pnpm install

    This will install all the dependencies for the monorepo and also run pnpm lint:ws && pnpm db:generate as a postinstall script.

Project Structure

The project is a monorepo using pnpm workspaces and Turborepo.

.
├── apps
│   ├── auth
│   ├── brand-service
│   ├── campaign-service
│   └── gateway
├── packages
│   ├── auth
│   ├── db
│   └── shared
├── tooling
│   ├── eslint
│   ├── prettier
│   └── typescript
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
└── turbo.json
  • apps: Contains the different microservices.
  • packages: Contains shared code, configs, and types.
  • tooling: Contains shared tooling configurations.

Development

To start all the services in development mode, run:

bash
pnpm dev

This command uses turbo run dev to start the development server for all the applications in the apps directory.

Running a single service

You can run a single service by using the --filter flag with turbo. For example, to run only the gateway service, you would use its package name in the filter.

bash
pnpm dev --filter=<package-name>...

Available Scripts

The following scripts are available at the root of the monorepo and can be run with pnpm <script>:

  • pnpm build: Build all the packages and apps.
  • pnpm dev: Start all the apps in development mode.
  • pnpm test: Run tests for all packages and apps.
  • pnpm lint: Lint all the code.
  • pnpm format: Format all the code with Prettier.

Database

The project uses Prisma for the database. The following scripts are available for managing the database. These scripts target the @ce-sdr/db package.

  • pnpm db:generate: Generate the Prisma client.
  • pnpm db:push: Push the schema changes to the database.
  • pnpm db:studio: Open the Prisma Studio.
  • pnpm db:seed: Seed the database with initial data.

Deployment

Deployment instructions will be added here.