davidmhewitt / appcenter-website

MIT License
2 stars 0 forks source link

AppCenter Website

This is the WIP code behind the (hopefully) new AppCenter website, including the app browser and the developer dashboard. It is separated into a Rust backend and a NextJS/Tailwind frontend.

Running

Set up a development environment using one of the methods below. Then either:

Run the Frontend (With Mock Data)

In multiple terminal tabs/windows:

cd frontend
npm ci
npm run mocks
cd frontend
npm run dev

Visit http://localhost:3000

Run the Frontend (with real data from the backend)

In multiple terminal windows:

cd backend
cargo run -p background-worker
cd backend
cargo run
cd frontend
npm ci
npm run dev

Visit http://localhost:3000

Setting up a development environment (the easy way)

The recommended way to set up a development environment is to use the devcontainer config for VSCode (or any other editor that supports the devcontainer spec). When prompted whether to use the "Local" or "Remote" config, use "Local". The "Remote" config is for use with GitHub codespaces. This will build a containerised development environment with the necessary Rust and Node toolchains and the required Postgres and Redis services.

Setting up GitHub integration

If you want to test the GitHub integration (GitHub login or submitting apps), you will need to define some GitHub secrets in the backend/.env file:

APP_GITHUB__CLIENT_ID=
APP_GITHUB__CLIENT_SECRET=
APP_GITHUB__USERNAME=
APP_GITHUB__ACCESS_TOKEN=
APP_GITHUB__REVIEWS_URL=

Stripe Integration

If you want to test the Stripe integration, you will need to define the secret in the backend/.env file:

APP_STRIPE__SECRET_KEY=sk_test_abcdef123456789

Database Migrations

If you need to make any changes to the backend database schema, you will need to install diesel with cargo install diesel_cli

Setting up a development environment (the manual way)

Requirements

Environment variables

In backend/.env, configure the following variables to appropriate values for your environment:

DATABASE_URL=postgresql://appcenter:appcenter@db/appcenter_website
APP_DATABASE__URL=postgresql://appcenter:appcenter@db/appcenter_website
APP_REDIS__URI=redis://redis

You may also want to configure the GitHub and Stripe environment variables as described above.