01 — designer-api setup¶
You've finished ../00-workstation-setup.md. Now stand up designer-api.
1. Clone¶
cd ~/src/someli
git clone git@github.com:Someli-ai/designer-api.git
cd designer-api
git checkout dev # the active dev branch (designer-api uses plain dev/uat/main)
Verify with the team if the active dev branch differs.
2. Install¶
Both work — the lockfile is yarn.lock. ~3–5 minutes on first run.
If installs fail with native-build errors (Sharp, Puppeteer / Chromium), revisit ../00-workstation-setup.md §2.
3. The .env file¶
The repo does not ship a .env.example. Ask the team for the dev .env.
The file lives at the project root: designer-api/.env. Loaded by dotenv via conf.js.
Variables you need at minimum¶
# Database (shared with someli-api in production)
host=...
user=...
password=...
database=someli
dbPort=3306
connectionLimit=10
# Server
port=5003 # IMPORTANT — see "port collision" below
Variables you need as soon as you exercise real features¶
| Feature | Vars |
|---|---|
SENDGRID_API_KEY, FROM |
|
| AWS S3 | AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY, S3_Bucket_Name, S3_Region, S3_Path, S3_Bucket_Name2, S3_Region2, S3_Path2, S3_Bucket_Url2 |
| OpenAI (AI content) | OPENAI_API_KEY |
| Stock images | PEXELS_API_KEY, PIXABAY_API_KEY |
News API (for trendsbot.js) |
NEWS_API_KEY |
That is the entire env surface. designer-api is strictly smaller than someli-api — no Paddle, no Stripe, no Passport, no Bedrock/Vertex, only OpenAI for AI. See ../../audit/designer-api/configuration.md for the full list.
conf/credentials.json¶
The repo contains conf/credentials.json, likely a Google service-account JSON. Verify whether it is committed (it should not be — secret material) and obtain a dev copy from the team.
4. Port collision — important¶
designer-api/server.js:5 reads:
someli-api, Someli-admin-api, and designer-api all default to port 5002. If you run two of them on the same machine without overrides, the second one fails to bind.
Fix: set port=5003 (or any unused port) in designer-api/.env. You'll point Someli-Designer (the FE) at that port.
5. Database¶
Same shared DB as someli-api. See ../someli-api/01-setup.md §4 for the three options (shared dev DB, local Docker, native install).
In production, all backends share one MySQL instance. For local dev, use the team's dev DB if you can — local Docker is a fallback if you're working offline.
6. Start the server¶
Default boot output:
[server.js] Express listening on 5003 (or whatever port you set)
[mysql] connect callback fired
[socket.io] listening
If you see Something Went Wrong! — MySQL is unreachable. Check the DB env vars.
7. Smoke test¶
designer-api does not ship a /health endpoint (one of the differences from someli-api). The simplest smoke test:
# Confirm the server is listening
curl -i http://localhost:5003/ # should respond (likely 404 or a banner)
# Confirm a known endpoint
curl -i http://localhost:5003/<some-endpoint-from-API-inventory>
See ../../audit/designer-api/API-inventory.md for the full endpoint list.
8. Background jobs and bots¶
designer-api has:
- ~57
job_*.jsfiles —node-cron-scheduled workers (industry-specific content generation, etc.) - ~6 standalone bots —
FAQsbot.js,quizbot.js,quotesbot.js,trendsbot.js,content_generation_bot.js,post_image_generation1_bot.js
You almost certainly do not want to run these locally on your first day. They connect to the shared DB and write into it.
The repo has no ecosystem.config.js (unlike someli-api). PM2 management is opaque from inside the repo — process orchestration happens outside.
Verify with the team: how are jobs and bots actually run in production? Is there a PM2 manifest in the deploy infra rather than the repo?
If you must run a job ad-hoc:
It loads .env via conf.js and connects to MySQL on its own.
9. You're done with setup¶
If yarn start succeeds on a non-colliding port and you can hit an endpoint, you are ready.
Next: 02-stack.md.
Troubleshooting¶
| Symptom | Likely cause |
|---|---|
EADDRINUSE :::5002 |
Port collision with someli-api or Someli-admin-api. Set port=5003 in .env. |
Something Went Wrong! |
MySQL unreachable. |
| CORS errors when hitting from the designer FE | server.js sends double CORS headers; one is malformed ("Access-Control-Allow-Credentials" : true as a string-named header). The browser ignores it. Don't try to "fix" CORS by adding more headers — read the existing code first. |
OpenAI: 401 |
OPENAI_API_KEY missing or invalid |
| Bot crashes on start | Likely missing env var for the specific bot — console.log(conf) to inspect |