This quickstart walks you through cloning the repository, configuring your environment, spinning up the PostgreSQL database via Docker, running migrations, seeding an admin user, and launching all three apps together. By the end you will have the backend API, admin dashboard, and public storefront running locally and ready for development.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ItsJhonAlex/Ecommerce/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure the following tools are installed on your machine:
- Bun ≥1.0 — bun.sh
- Docker (with the Compose plugin) — docs.docker.com
- Git
Setup
Install dependencies
Install all workspace dependencies from the monorepo root in a single command:Bun resolves workspaces declared under
apps/* and packages/* and hoists shared dependencies automatically.Configure environment variables
Copy the example environment file and edit the values to match your local setup:The
Generate a strong
.env file at the monorepo root is shared by all apps via --env-file=../../.env:| Variable | Default | Purpose |
|---|---|---|
POSTGRES_USER | avanzar | PostgreSQL username |
POSTGRES_PASSWORD | changeme | PostgreSQL password — change this |
POSTGRES_DB | avanzar | Database name |
POSTGRES_HOST_PORT | 5433 | Host port mapped to the container’s 5432 |
DATABASE_URL | postgres://avanzar:changeme@localhost:5433/avanzar | Full connection string used by Drizzle |
PORT | 3000 | Hono backend listen port |
BETTER_AUTH_SECRET | changeme | Secret key for session signing — generate a strong value |
BETTER_AUTH_URL | http://localhost:3000 | Public base URL of the backend, used by Better Auth |
BETTER_AUTH_SECRET with:Start the PostgreSQL database
Launch the PostgreSQL 17 container in the background:This runs
docker compose up -d. The container is named avanzar_postgres and exposes the database on the host port defined by POSTGRES_HOST_PORT (default 5433). A Docker volume named avanzar_pgdata persists data across restarts.Run database migrations
Apply all Drizzle migrations to the running database:This delegates to
drizzle-kit migrate inside the @avanzar/db package, creating all tables, enums, and constraints defined in the schema.Create an admin user
Seed the initial admin account using the bootstrap script. Run it from the monorepo root via the workspace filter:Alternatively, run it directly from the backend directory:This executes
apps/backend/src/scripts/create-admin.ts via bun run --env-file=../../.env, creates a user through Better Auth, and promotes it to the admin role. Follow the interactive prompts in your terminal to set the name, email, and password. The script is idempotent — if the email already exists it will only update the role.Running Services
Oncebun run dev is running, the following services are available:
| Service | URL |
|---|---|
| Backend API | http://localhost:3000 |
| API Docs (Swagger UI) | http://localhost:3000/api/v1/docs |
| Storefront | http://localhost:4321 |
| Admin Dashboard | http://localhost:5174 |
Running Individual Apps
To start only one app at a time, use the targeted dev commands from the monorepo root:Database Commands
All database operations are available as root-level scripts that delegate to the@avanzar/db package:
| Command | Description |
|---|---|
bun run db:generate | Generate a new Drizzle migration from schema changes |
bun run db:migrate | Apply pending migrations to the database |
bun run db:push | Push schema changes directly without a migration file |
bun run db:studio | Open Drizzle Studio in the browser for visual DB inspection |
bun run db:up | Start the PostgreSQL Docker container (docker compose up -d) |
bun run db:down | Stop and remove the PostgreSQL Docker container |