Hive prototype, lihive meets rust backend
- rust/cargo
- nodejs
- a Firebase project w/ Authentication setup
- Sign-in providers enabled:
- Anonymous
- Sign-in providers enabled:
- a Postgres database
- Diesel CLI
- Setup a Firebase project as defined above, making note of its Web API key, project ID, and project auth domain
- Create an
.env.local
file for the frontend:
js/frontend/.env.local
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID="
- Run the nextjs dev server. This is configured to proxy
/api
requests to the rust backend
$ npm install
$ npm run --workspace js/hive-lib build
$ npm run --workspace js/frontend dev
- Create a
.env
file for the backend:
backend/.env
DATABASE_URL= # whatever the connection string for your Postgres database is
TEST_DATABASE_URL= # whatever the connection string for your Postgres test databse is, needed for cargo test to work
FIREBASE_JWT_ISSUER= # this should be "https://securetoken.google.com/<projectId>", where projectId is your firebase project ID as above
STATIC_FILES_PATH=./dist # we'll set this up in a moment
- Create the static files directory
mkdir backend/dist
- Run the Diesel migrations, if you haven't already:
$ cd backend
$ diesel migration run
- Run the backend server:
$ cd backend
$ cargo run
- Go to
http://localhost:3000
(the nextjs dev server's url)