Developer Cookbook & Getting Started
Welcome to the Fundraising Event developer guide. This cookbook provides practical recipes to get you up and running, customize the platform, and troubleshoot common issues.
🥘 Prerequisites
Before cooking, ensure you have the following ingredients: - Node.js: v20+ (managed via pnpm) - Docker: For PostgreSQL and Redis services - pnpm: Install via npm install -g pnpm
Useful Links
- Repository: github.com/Mouness/fundraising-event
- Issues: github.com/Mouness/fundraising-event/issues
- Pull Requests: github.com/Mouness/fundraising-event/pulls
- Online Documentation: Mouness.github.io/fundraising-event
🧪 Running Tests
For detailed instructions on Unit, Integration, and E2E testing, see the Testing Strategy guide.
Quick Commands
- Unit Tests:
pnpm test - Test Coverage:
pnpm test:cov - E2E Tests:
pnpm test:e2e(Requires running app)
🚀 Recipe 1: The Quick Start (Local Dev)
Goal: Run the full stack (API + Database + Frontend) on your machine.
-
Clone & Install
git clone https://github.com/your-org/fundraising-event.git cd fundraising-event pnpm install -
Environment Config
- Copy
.env.exampleto.envinapps/apiandapps/web. - Tip: The default values work out-of-the-box for local docker services.
- Note: Production settings (Stripe/PayPal keys) can also be configured securely in the Admin Panel.
- Copy
-
Start Infrastructure Launch Postgres and Redis:
docker compose --profile infra up -d -
Initialize Database Push the schema to your local Postgres:
pnpm prisma migrate dev -
Set Admin Password Create the initial admin password (hashed):
pnpm --filter api set-admin-password "StrongPassword123!" -
Serve code! Start both API (port 3000) and Web (port 5173):
pnpm devSuccess! Visit http://localhost:5173 and login with
admin@example.com/StrongPassword123!.Alternative: Full Docker Stack
If you prefer to run everything (API, Web, DB, Redis) in Docker:
# Starts Infrastructure (db, redis) AND Application (api, web) docker compose --profile application up --build -dNote: The web app will run on port 8080 in this mode.
🎨 Recipe 2: Customizing the Theme
Goal: Change the brand colors for a specific client.
- Log in to Admin Dashboard.
- Go to Global Settings > Brand Design.
- Use the color pickers (or use HTML Color Codes) to get the Hex color codes:
Primary Color(--primary): Main buttons and links.Radius(--radius): Roundness of cards and inputs.
- Click Save.
- Refresh: The changes apply instantly across the platform (Live Page, Donation Form, Admin Panel).
🎫 Recipe 3: Creating an Event
Goal: Set up a "Winter Gala" fundraiser.
- Navigate to Events > Create Event.
- Basics:
- Name:
Winter Gala 2025 - Slug:
winter-gala(URL will be.../events/winter-gala) - Goal:
50000(50k currency units)
- Name:
- Configuration:
- Go to Live Screen Settings.
- Select Elegant Theme (Best for Galas).
- Choose Vertical Gauge.
- Payment (Optional):
- Go to Global Settings > Payment.
- Ensure Stripe/PayPal keys are set if not using Environment Variables.
- Launch:
- Set Status to
Active. - Open
http://localhost:5173/events/winter-gala/liveon the projector.
- Set Status to
🛠️ Troubleshooting (The "Fix-it" Menu)
Problem: Connection refused (Database)
Symptoms: API fails to start with Prisma Client initialization error.
Solution:
- Check Docker status:
docker ps - If distinct container is missing:
docker-compose up -d - Verify port 5432 is not occupied by another Postgres instance on your machine.
Problem: Invalid Credentials / Login Failed
Symptoms: You forgot the admin password or the initial password doesn't work.
Solution:
- Run the password reset command:
pnpm --filter api set-admin-password "NewStrongPassword123!" - Restart the API server (
pnpm devordocker compose restart api).
Problem: Missing Translations (Keys showing)
Symptoms: You see text like donation.title or admin.header instead of real words.
Solution:
- This often happens if the
white-labelingpackage was updated but not rebuilt. - Stop the dev server.
- Run:
pnpm build --filter @fundraising/white-labeling - Start dev server again:
pnpm dev.
Problem: Prisma Client not initialized
Symptoms: Error Error: @prisma/client did not initialize yet.
Solution:
- This means the generated client code is out of sync with your schema.
- Run:
pnpm prisma generate - Restart the API server.
Problem: PaymentIntent fails in Webhook
Symptoms: Logs show "Webhook Error: No signature found".
Solution:
- Ensure
stripe listenis running. - Verify
STRIPE_WEBHOOK_SECRETinapps/api/.envmatches the CLI output (whsec_...).
Problem: Staff Interface shows "Offline"
Symptoms: Red indicator in top right corner.
Solution:
- Check browser network tab.
- Verify
VITE_API_URLinapps/web/.envdefaults tohttp://localhost:3000/api. - Ensure CORS allowed origin in
apps/api/.envincludeshttp://localhost:5173.
📚 Common Commands
| Command | Action |
|---|---|
docker compose --profile infra up -d |
Start DB & Redis |
docker compose --profile application up --build |
Start Full Stack (Infra + App) |
pnpm dev |
Start dev servers |
pnpm build |
Build for production |
pnpm test |
Run unit tests |
pnpm lint |
Fix linting issues |
pnpm prisma studio |
Open Database GUI |