Skip to main content

Local Setup

How to run the Seken project locally from scratch. For developers onboarding to the project.

Prerequisites​

Install these tools before starting:

ToolVersionInstall
Node.js20+nodejs.org
pnpm9+npm install -g pnpm or corepack enable
GitAnygit-scm.com
DockerLatestdocker.com (for local Postgres)
Flutter SDK3.41flutter.dev
Dart3.xIncluded with Flutter
Android Studio / XcodeLatestFor mobile builds

1. Clone the Repository​

git clone https://github.com/pasarseken/pasarseken.git
cd pasarseken

2. Set Up Environment Variables​

Copy the example env file and fill in your values:

cp .env.example .env

See Environment Variables → for the full list of required variables. Get values from the team's shared secrets manager.

Never Commit .env

The .env file is in .gitignore. Never commit it. If you accidentally commit secrets, rotate the affected keys immediately, see Maintenance Guide →.


3. Install Web Dependencies​

pnpm install

The project is pnpm-only (pnpm-lock.yaml). Don't use npm install, it will produce a conflicting package-lock.json.


4. Start the Web Dev Server​

pnpm dev

The React app will be available at http://localhost:5173 (or the port Vite assigns).

# Other useful commands
pnpm build # Production build
pnpm preflight # Typecheck + lint + brand-check + tests (run before every push)

5. Start the Backend​

The backend is a NestJS + Fastify application. It expects a PostgreSQL connection via DATABASE_URL.

For local development, start a PostgreSQL instance via Docker (or point at the staging database if approved):

# Example: start a local Postgres container
docker run -d --name seken-pg \
-e POSTGRES_PASSWORD=localpass \
-p 5432:5432 postgres:15

# Set DATABASE_URL in your .env
# DATABASE_URL=postgresql://postgres:localpass@localhost:5432/seken

Then start the NestJS backend:

cd backend
pnpm install
pnpm start:dev

Apply the database schema (migrations live at supabase/migrations/*.sql — path is historical):

# Apply the SQL migration files to your local Postgres, in filename order
for f in supabase/migrations/*.sql; do psql "$DATABASE_URL" -f "$f"; done

Test the health check:

curl http://localhost:3000/health
# Expected: { "ok": true, "version": "..." }

A seed data script does not exist yet. To populate test data, create a listing manually through the web app UI after starting the dev server.


6. Set Up the Flutter App​

cd mobile

# Get dependencies
flutter pub get

# Check your environment
flutter doctor

# Run on a connected device or simulator.
# The mobile app reads ALL config at compile time via Flutter dart-defines —
# running with none starts with empty defaults. Pass them inline
# (or put them in a file and use --dart-define-from-file=.env):
flutter run \
--dart-define=FLUTTER_ENV=development \
--dart-define=API_BASE_URL=http://localhost:3000

# Run on a specific platform (append the same --dart-define flags)
flutter run -d ios
flutter run -d android
flutter run -d chrome # Web target (limited support)

See Flutter → for project structure, conventions, and common tasks. The mobile README.md in the pasarseken repo is the authoritative source for the full dart-define contract (every required key).


7. Verify Everything Works​

After setup, test these flows manually:

  • Web app loads at http://localhost:5173
  • Backend health check returns { ok: true } at http://localhost:3000/health
  • Mobile app runs on simulator
  • Login / signup flow works
  • Create a test listing with photos
  • AI categorization returns results

Development Workflow​

# Before every push
pnpm preflight # Must pass — typecheck, lint, brand-check, tests

# Branch flow: branch off main, then open two PRs from the same branch:
# first into develop (staging validation), then into main. Never branch off
# develop, and never open a PR from develop into main.
# CI auto-deploys both frontend and backend via DOCR + Dokploy on each branch merge.

See Deployment → for the full release process.


Common Setup Issues​

ProblemLikely CauseFix
Postgres connection refusedDocker container not runningStart the Postgres container; check DATABASE_URL in .env
Backend 401 on all routesMissing or malformed auth headersEnsure both Authorization and X-User-Token are sent
Flutter pub get failsOutdated Flutter SDKRun flutter upgrade
Vite port conflictPort 5173 in useKill the process or set VITE_PORT in .env
OpenAI vision returns errorInvalid API keyCheck OPENAI_API_KEY in .env
Apple Silicon, Flutter build fails for iOSRosetta not installedRun softwareupdate --install-rosetta then retry
Apple Silicon, pnpm install native module errorsArchitecture mismatchRun arch -x86_64 pnpm install or use an x86_64 terminal session

Add new issues to this table as they are discovered during onboarding.