The website runs using the Astro framework, with authentication handled through GitHub via an OAuth app and a database backend using MariaDB and Prisma.
To setup the Modtoberfest-Site to run locally for development, you will first need the following:
npm
, particularly for running Astro (for the site itself) and Prisma (for database migrations).- Docker and docker-compose, to run the dev database.
- A GitHub OAuth app, for authentication. (See the next section on how to create one)
- On GitHub, go to
Settings > Developer settings > OAuth Apps
. - Click on the "New OAuth App" button.
- Fill in the required elements for the OAuth app:
- Set the "Application name" to anything (though likely use an identifiable name like "Modtoberfest-Site-Dev").
- Set the "Homepage URL" to
http://127.0.0.1:4321
. - Set the "Authorization callback URL" to
http://localhost:4321/auth/github/callback
. - Leave un-ticked the "Enable Device Flow" checkbox.
- Click on the "Register application" button.
- Take note of the "Client ID" for later.
- Beside the "Client secrets" header, click the "Generate a new client secret" button.
- Copy the displayed client secret for later.
After creating the OAuth app, you should have the app client ID and app client secret.
- Clone the repository locally.
- Install all the necessary dependencies:
npm install
- Copy the
.env.example
file into an.env
file. (The copied file is git-ignored.) - In the newly-copied
.env
file:- Put the app client ID after the
GITHUB_ID=
line. - Put the app client secret after the
GITHUB_SECRET=line
.
- Put the app client ID after the
- Bring up the database through Docker:
docker compose -f docker-compose-dev.yml up db
- Initialize the database:
npm run migrate
- Bring up the local site server:
npm run dev
After those steps, you should have a local copy of the site accessible at http://localhost:4321/ (which should be noted in the console output.)
To bring the site down gracefully:
- Bring down the database:
docker compose -f docker-compose-dev.yml down db
- Terminate the
npm run dev
command using theCTRL + C
keyboard shortcut.