Tool to automate assignment of articles, manage summaries, provide an API for content and sharing them on @scribeDAO. If you have any questions or want to help out join us on Discord #automation
Want to help out? Let's setup this project!
- Clone the repository
- Run
yarnto install dependencies - Copy
.env.local.exampleto.envand fill in the values - You will need a MySQL database. You can:
- Install MySQL locally OR
- Run it in a docker container. There is a
db/docker-compose.yml. You can runcd db && docker-compose pullto install and thenyarn start:dbto start the server. OR - Use a remote database service like planetscale
- You need to also fill in the
.envfile Discord Credentials. You can get those from the ScribeDAO App on Discord Developer Portal - Run
yarn devto start the server and open the browser. Happy coding!
- For Database we use MySQL (that is what planetscale offers currently).
- Prisma v2 ORM is used.
- You can find database schema in
prisma/schema.prisma. There is a DBML version inprisma/dbml/schema.dbmlalso generated which you can use to visualize the schema in DB Diagram/
- You can find database schema in
- User logs in with discord
- We use our Bot to check if the users is in our server
- Then we check if the user has Knowledge Seeker or above role, if so they are logged in.
- When user account is created and linked in DB we grab user's roles from Discord and link them to user in DB.
- Flaws: If user's role is updated we can't automatically update in DB. Read more in this issue #5
We use Vercel to deploy this project to production. We have GitHub Actions to deploy to production. For database Vercel will connect to MySQL instance running in planetscale
We use prisma db push to apply migrations. See prisma/prisma#9703 (comment). Please do not apply migrations in production.
- Login to PlanetScale
pscale login - Create 2 branches from
mainone feature branch and othershadowpscale branch create scribedao-prod <FEATURE_NAME>pscale branch create scribedao-prod shadow
- Now connect to the branches so you can connect to DB locally.
pscale connect scribedao-prod <FEATURE_NAME> --port 3309pscale connect scribedao-prod shadow --port 3310
- Now apply new migrations
yarn prisma db push
- Create a Deploy request (kinda like a PR but for DB)
pscale deploy-request create scribedao-prod <FEATURE_NAME>
- Now just need to merge your code on GitHub and apply those DB changes and we are done!
WARNING: You will be connecting and updating prod database
- Create a
shadowbranch frommainpscale branch create scribedao-prod shadow
- Now connect to the branches so you can connect to DB locally.
pscale connect scribedao-prod main --port 3309pscale connect scribedao-prod shadow --port 3310
yarn prisma db seed- You can view your change in prisma studio
yarn prisma studio
- Get the latest backup
pscale backup list scribedao-prod main
- Create new branch
pscale backup restore scribedao-prod dev <BACKUP_ID>pscale backup restore scribedao-prod shadow <BACKUP_ID>
More: planetscale/discussion#112
We use Sentry for errors and performance monitoring.
Note: currently this is on personal account we need to move to Open Source account.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Prisma Documentation
- NextAuth.js
v3 - PlanetScale applying prisma migrations