跳到主要内容
版本:Current

安装

1. 克隆与依赖​

git clone git@github.com:BU-CSSA-Tech/CSSA-Election.git
cd CSSA-Election
npm install

本地工作区目录名可能是 election,与远程仓库名不同,不影响运行。

2. 环境变量​

cp .env.example .env.local

填写:

DATABASE_URL=postgresql://...
AUTH_SECRET=
AUTH_GOOGLE_ID=
AUTH_GOOGLE_SECRET=
# 仅空库冷启动时临时使用,生产不要开
# AUTH_ALLOW_EMPTY_USER_TABLE=1

.env.example 未列出 AUTH_ALLOW_EMPTY_USER_TABLE,完整说明见 Environment Variables。

DATABASE_URL 不要带 options=search_path=...。SQL 一律写 public.*。

3. 迁移​

在 Neon SQL Editor 或 psql 中按编号执行尚未跑过的文件:

  1. db/migrations/001_user_system.sql
  2. 002_campaign_rule_weights.sql
  3. 003_drop_voter_ballot_weights.sql
  4. 004_drop_position_vote_defaults.sql
  5. 005_campaign_candidate_options.sql
  6. 006_drop_ballots_redundant_columns.sql
  7. 007_ballot_allocations.sql

生产执行前备份,尤其是 001、005、007。详见 Database Migrations。

4. 启动​

npm run dev

打开 http://localhost:3000,应跳到登录页或首页。