This is a web app that supports mentorship programs at Visionary Education Foundation (远见教育基金会) developed by VEF volunteers.
- Install
node.jsandyarn. - Install
postgresql, start it locally, and create a database calledyuanjian. Aternatively, use a hosted Postgres solution such as Neon. - Create file
.envin the repository root with the following content:Optinoally, seeDATABASE_URI=postgres://localhost/yuanjian NEXTAUTH_SECRET=123.env.templatefor more environment variables you can set in.env. - Run
yarnto install dependency packages.- If you run into error
"$VERCEL_ENV" was unexpected, see thisdoc.
- If you run into error
- Run
yarn migrate-db && yarn gen-demo-datato initialize the database. - Run
yarn devto start local server. By default it will listen onlocalhost:3000. - Visit the local server from broswer. Sign up with email
admin@de.mo.- When prompted to enter a verification code, find the
"token": "..."string fromyarn dev's command-line output and enter the six-digit token.
- When prompted to enter a verification code, find the
- If you use MacOS, run
chmod ug+x .husky/*to activate husky/git hooks.
- Cursor rules (mainly auto generated)
- Coding style
We follow next.js convention:
public |
Static assets. |
src |
Source folder. Files under src but outside of src/api may be executed either in the browser or on the server. |
src/api |
Files to be executed on the server only. |
src/pages |
next.js Page Router. Migrating to App Router remains future work. |
src/shared |
Files shared between src/api and the rest of src. |
tools |
Command-line scripts. |
cypress/e2e |
End-to-end tests. See documentation. |
To prevent security and programming issues, eslint is configured to enforce the following rules:
- files in
src/sharedmust not refer to files outside ofsrc/shared, - files in
src/apimust not refer to files outside ofsrc/apiorsrc/shared, and - files outside of
src/apimust not refer to files insrc/api
That is, only the dependencies demonstrated below are allowed:
graph TD;
src[the rest of src]-->|ok|src/shared;
src/api-->|ok|src/shared;
- Run
yarn testto run all unit tests.- If you run into error
TS_NODE_PROJECT' is not recognized as an internal or external command, see thisdoc.
- If you run into error
- See this doc for end-to-end testing.
Browse the docs folder.