Quickstart
Quickstart
Section titled “Quickstart”This page gives you the fastest reliable path to run Leci locally and confirm your setup works.
Quickstart is optimized for first successful run
Section titled “Quickstart is optimized for first successful run”The goal of this quickstart is to validate the repository baseline in minutes, not to explain every option. You will install dependencies, configure environment variables, run migrations, and start the app.
Prerequisites are explicit and minimal
Section titled “Prerequisites are explicit and minimal”You need the following before running commands:
- Node.js
>=20.0.0(frompackage.jsonengines) - npm
>=10.0.0(frompackage.jsonengines) - Access to a PostgreSQL database URL for
DATABASE_URL
The project currently uses:
- Next.js for the app runtime
pgfor database connectivity in migration script- Drizzle schema/migration conventions via SQL files in
drizzle/
Run these commands in order
Section titled “Run these commands in order”Use the exact command sequence below from the repository root.
# 1) Install dependenciesnpm install
# 2) Create local env filecp .env.example .env
# 3) Set DATABASE_URL in .env# Example format:# DATABASE_URL=postgresql://user:password@host:5432/database
# 4) Apply SQL migrationsnpx tsx scripts/migrate.ts
# 5) Start the dev servernpm run devThen open:
http://localhost:3000
Expected UI baseline:
- title text
Leci - subtitle
Plataforma de busca de legislação brasileira federal
Verify baseline quality commands
Section titled “Verify baseline quality commands”After the app starts, run the quality checks below.
# Lint checksnpm run lint
# Test runner (currently no suites yet, but command must execute)npm testExpected current test output includes zero suites/tests; this is normal for the current roadmap stage.
Understand migration behavior before rerunning
Section titled “Understand migration behavior before rerunning”The migration runner (scripts/migrate.ts) reads every .sql file in drizzle/, sorts by numeric prefix, and executes each file in sequence every run.
const files = fs.readdirSync(drizzleDir) .filter((file) => file.endsWith(".sql")) .sort((a, b) => { const aNum = Number.parseInt(a.split("_")[0] ?? "0", 10); const bNum = Number.parseInt(b.split("_")[0] ?? "0", 10); return aNum - bNum; });Common quickstart failures and immediate fixes
Section titled “Common quickstart failures and immediate fixes”These are the most likely first-run issues.
Error: DATABASE_URL is not set
Section titled “Error: DATABASE_URL is not set”Cause: .env missing or variable unset.
Fix:
- Confirm
.envexists. - Confirm
DATABASE_URL=is present and non-empty. - Re-run migration command.
Error: PostgreSQL connection refused / timeout
Section titled “Error: PostgreSQL connection refused / timeout”Cause: database host unreachable or wrong credentials.
Fix:
- Verify host/port/user/password in
DATABASE_URL. - Confirm network access (VPN/firewall) if using hosted DB.
- Test URL with a DB client, then rerun.
Error while applying migration SQL
Section titled “Error while applying migration SQL”Cause: schema permissions, extension availability, or non-idempotent statements.
Fix:
- Ensure target DB user can create schema/extensions as needed.
- Check
drizzle/0001_init.sqlrequirements (vectorextension). - Inspect the failing SQL statement and validate target DB state.
App starts but page is not what you expected
Section titled “App starts but page is not what you expected”Cause: current UI is intentionally minimal.
🚧 Planned Feature — Search/browse/read product flows are roadmap items and not implemented yet.
What to do after quickstart
Section titled “What to do after quickstart”After baseline run succeeds, continue with:
docs/getting-started/installation.mdfor full setup and reproducible environment standards.docs/development/setup.mdfor contributor workflow.docs/features/index.mdto understand implementation status by capability.