Overview
Flashcards is a simple CRUD app that allows users to create their own flashcards and categories. It also provides a practice mode where users can review the flashcards either in order or randomly. The app aims to demonstrate Distributed Tracing in Next.js using Sentry.
Features
- Create and manage flashcards
- Create and manage categories for flashcards
- Practice mode to review flashcards
- Ability to show flashcards in order or randomly
Installation
To run the Flashcards app locally, follow these steps:
- Rename the
.example.envfile to.env. - Replace the
DATABASE_URLvalue in the.envfile. You can use any MySQL service (like Cloud SQL or PlanetScale) or set up a local MySQL instance. - Paste your project’s DSN string for the
SENTRY_DSNandNEXT_PUBLIC_SENTRY_DSNvalues in the.envfile. - Generate a random string for the
NEXTAUTH_SECRETvalue. This value can include numbers and special characters. - If you don’t have a Sentry account or don’t want to use Sentry, you can skip setting up the
SENTRY_DSNandNEXT_PUBLIC_SENTRY_DSNvalues for now. - Once you have the environment variables set, install the dependencies by running
pnpm install. - Set up your database by following these instructions:
- Run
npx prisma generateto generate the Prisma client based on the schema. - Run
npx prisma db pushto initialize your database branch. - Run
npx prisma db seedto add demo data (categories and flashcards) so you don’t have to manually create them.
- Run
- After setting up the database, start the app locally by running
pnpm devcommand. - Visit
localhost:3000in your browser to access the app. - The app will display a sign-in screen. If you seeded the demo data, you can sign in with the email
admin@admin.comand passwordadmin. Otherwise, you can create a new account by entering your email and password. Note that the “sign in” option also doubles as a “register” option.
Summary
Flashcards is a simple CRUD app that allows users to create and manage flashcards and categories. It also offers a practice feature to review flashcards. The app demonstrates Distributed Tracing in Next.js using Sentry. To install and run the app locally, you need to set up the environment variables, install dependencies, and configure the database. Once set up, you can access the app on localhost:3000 and use the provided demo data or create a new account.