Getting Started
This section will guide you through the process of setting up your development environment and getting started with the development of our application.
Our repository
We are using a Turborepo monorepo setup with pnpm workspaces. This includes multiple apps, shared packages as well as our background services. You can find more information about turborepo here.
Repository: https://github.com/ace-mate/acemate
acemate/
├── apps/ # User facing applications
│ ├── cms/ # Payload CMS
│ ├── design-system/ # Design system components
│ ├── docs/ # Documentation site
│ └── web/ # Main webapp
│
├── packages/ # Shared packages
│ ├── ai/ # AI-related utilities
│ ├── posthog/ # Posthog event definitions
│ ├── tsconfig/ # Shared TypeScript configs
│ ├── types/ # Shared TypeScript types
│ ├── ui/ # Shadcn & Payload Component
│ └── utils/ # Common utilities
│
├── scripts/ # Utility scripts
│ ├── supabase/ # Supabase scripts
│ └── .../ # ... other scripts
│
└── services/ # Background services
├── api/ # API service
├── cloudflare/ # Cloudflare services
│ ├── container/ # Cloudflare Container
│ ├── workers/ # Cloudflare Workers
│ └── workflows/ # Cloudflare Workflows
├── gcloud/ # Google Cloud services
├── listmonk/ # Email service (Docker)
└── supabase/ # Supabase
├── functions/ # Supabase Edge Functions
└── migrations/ # Database migrations
Setting up Supabase
- Make sure to have Docker installed and running on your machine.
- Install the Supabase CLI. You can find the installation instructions here.
- Navigate into the
services/supabasedirectory and run the following command to generate signing keys:supabase gen signing-key --algorithm ES256 - In the same directory run the following command to start the Supabase instance:
When you start it for the first time, it will take some time to download the required docker images. Once it is done, you will see the following message:
supabase startStarted supabase local development setup.
API URL: http://localhost:54321
DB URL: postgresql://postgres:postgres@localhost:54322/postgres
Studio URL: http://localhost:54323
Inbucket URL: http://localhost:54324
Publishable key: eyJh......
Secret key: eyJh...... - Populate the database with some seed data. You can find the corresponding
.csvfiles in our Google Drive. Please ask Jan to give you access.
Environment Variables
Create a new file named .env.local in the root directory of the project and copy the content of the .env.example file into it. Then fill in the correct values for the environment variables. Please ask Jan to provide you with the correct values.
NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJh...
Starting the webapp
- Install all dependencies by running the following command in the root directory of the project:
pnpm install - Start the development server by running the following command.
pnpm run dev:web
In the root package.json you can find all the available scripts. It is not recommended to use the pnpm run dev command as it will start all the services and apps. Rather use the specific scripts for the apps & services you want to start.
Setting up Workers
In order to connect the workers to the local wrangler setup used by the webapp, you need to create symbolic links to the .wrangler folder of the webapp.
You can achieve this by running the following command:
./scripts/add_symlinks.sh
The first time you start the workers, Cloudflare is gonna ask you if you want to send anonymous usage data to them. This causes an error because you cannot answer "yes" when starting all the workers at once.
In order to fix this, you need to start only one worker by navigating for example to workers/document-processing and running pnpm run dev and then answer n or Y when Cloudflare asks you. You can then abort and navigate back to the root directory.
Happy coding!