docs: add development instructions
This commit is contained in:
parent
3a302c87c3
commit
f7977eafa2
3 changed files with 92 additions and 3 deletions
|
|
@ -1,11 +1,13 @@
|
||||||
DATABASE_URL="postgresql://frieren:frieren@localhost:5432/tomodachi-share?schema=public"
|
# Your PostgreSQL database
|
||||||
|
DATABASE_URL="postgresql://postgres:frieren@localhost:5432/tomodachi-share?schema=public"
|
||||||
# Used for rate limiting
|
# Used for rate limiting
|
||||||
REDIS_URL="redis://localhost:6379/0"
|
REDIS_URL="redis://localhost:6379/0"
|
||||||
|
|
||||||
BASE_URL=https://tomodachi-share.trafficlunar.net
|
# Used for metadata, sitemaps, etc.
|
||||||
|
BASE_URL=http://localhost:3000
|
||||||
|
|
||||||
# Check Auth.js docs for information
|
# Check Auth.js docs for information
|
||||||
AUTH_URL=https://tomodachi-share.trafficlunar.net # This should be the same as BASE_URL
|
AUTH_URL=http://localhost:3000 # This should be the same as BASE_URL
|
||||||
AUTH_TRUST_HOST=true
|
AUTH_TRUST_HOST=true
|
||||||
AUTH_SECRET=XXXXXXXXXXXXXXXX
|
AUTH_SECRET=XXXXXXXXXXXXXXXX
|
||||||
AUTH_DISCORD_ID=XXXXXXXXXXXXXXXX
|
AUTH_DISCORD_ID=XXXXXXXXXXXXXXXX
|
||||||
|
|
@ -13,6 +15,7 @@ AUTH_DISCORD_SECRET=XXXXXXXXXXXXXXXX
|
||||||
AUTH_GITHUB_ID=XXXXXXXXXXXXXXXX
|
AUTH_GITHUB_ID=XXXXXXXXXXXXXXXX
|
||||||
AUTH_GITHUB_SECRET=XXXXXXXXXXXXXXXX
|
AUTH_GITHUB_SECRET=XXXXXXXXXXXXXXXX
|
||||||
|
|
||||||
|
# Currently only supports one admin
|
||||||
NEXT_PUBLIC_ADMIN_USER_ID=1
|
NEXT_PUBLIC_ADMIN_USER_ID=1
|
||||||
# Separated by commas
|
# Separated by commas
|
||||||
NEXT_PUBLIC_CONTRIBUTORS_USER_IDS=176
|
NEXT_PUBLIC_CONTRIBUTORS_USER_IDS=176
|
||||||
84
DEVELOPMENT.MD
Normal file
84
DEVELOPMENT.MD
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
# TomodachiShare Development Instructions
|
||||||
|
|
||||||
|
Welcome to the TomodachiShare development guide! This project uses [pnpm](https://pnpm.io/) for package management, [Next.js](https://nextjs.org/) with the app router for the front-end and back-end, [Prisma](https://prisma.io) for the database, [TailwindCSS](https://tailwindcss.com/) for styling, and [TypeScript](https://www.typescriptlang.org/) for type safety.
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
To get the project up and running locally, follow these steps:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git clone https://github.com/trafficlunar/tomodachi-share
|
||||||
|
$ cd tomodachi-share
|
||||||
|
$ pnpm install
|
||||||
|
```
|
||||||
|
|
||||||
|
Prisma types are generated automatically post-install, which is quite convenient. However, sometimes you might need to:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Generate Prisma client types
|
||||||
|
$ pnpm prisma generate
|
||||||
|
|
||||||
|
# Or, if you've added new database properties
|
||||||
|
$ pnpm prisma migrate dev
|
||||||
|
$ pnpm prisma generate
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment variables
|
||||||
|
|
||||||
|
You'll need a PostgreSQL database and Redis database. I would recommend using [Docker](https://www.docker.com/) to set these up quickly. Just create a `docker-compose.yaml` with the following content and run `docker compose up -d`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
restart: always
|
||||||
|
shm_size: 1024mb
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: frieren
|
||||||
|
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 6379:6379
|
||||||
|
```
|
||||||
|
|
||||||
|
After, make a copy of the `.env.example` file and rename it to `.env`. The database variables should be pre-configured, but you'll need to fill in the rest.
|
||||||
|
|
||||||
|
For the `AUTH_SECRET`, run the following in the command line:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pnpx auth secret
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, let's get the Discord and GitHub authentication set up.
|
||||||
|
|
||||||
|
For Discord, create an application in the developer portal, go to 'OAuth2', copy in the Client ID and Secret into the respective variables and also add this as a redirect URL: `http://localhost:3000/api/auth/callback/discord`.
|
||||||
|
|
||||||
|
For GitHub, navigate to your profile settings, then 'Developer Settings', and create a new application. Set the homepage URL to `http://localhost:3000` and copy the Client ID and generate a new client secret. Finally, add in a callback URL with the value `http://localhost:3000/api/auth/callback/github`.
|
||||||
|
|
||||||
|
After configuring the environment variables, you can run a development server.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pnpm dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
It's a good idea to build the project locally before submitting a pull request. This helps catch any potential errors and see how things will look in a production environment.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build the project
|
||||||
|
$ pnpm build
|
||||||
|
|
||||||
|
# Run the built version
|
||||||
|
$ pnpm start
|
||||||
|
```
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
- 🌎 Browse and add Miis from other players
|
- 🌎 Browse and add Miis from other players
|
||||||
- 🏝️ Build your perfect island by finding the perfect residents
|
- 🏝️ Build your perfect island by finding the perfect residents
|
||||||
|
|
||||||
|
### <a href="/DEVELOPMENT.MD">Development Instructions</a>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue