Welcome to BeavBright! This is a monorepo for the BeavBright project, a platform for Oregon State University students to find and share resources for their classes. This project is being developed and maintained by the Oregon State University App Development Club.
BeavBright's code organization is based on this awesome turborepo template. We have added some customizations to it to make it more suitable for our needs.
- TurboRepo for managing the beavbright monorepo
- Tailwind CSS for utility-first CSS
- shadcn/ui for a design system
- Framer Motion for animations and transitions
- Next.js as our frontend framework
- Hono as our backend framework
- JWT for authentication and authorization
- Docker for containerization, with docker-compose watch for hot reloading
- Prisma as our type-safe database client
- PostgreSQL as our database
- Snaplet for seeding the database
- TypeScript for static type checking and improved developer experience
- ESLint for linting and code quality checks
- dotenv-cli (for managing environment variables)
- pnpm (v6 or higher)
- Docker (for running the database)
- Node.js (v14 or higher)
- OpenSSL (for generating JWT secrets - optional)
- Clone the repository:
git clone https://github.com/OSU-App-Club/beavbright.git
- Install the following:
pnpm install -g dotenv-cli
- Create your
.env.local
files in thepackages/database
andapps/web
directories:
cp packages/database/.env.example packages/database/.env.local
cp apps/web/.env.example apps/web/.env.local
Important
Be sure to replace the empty values in the .env.local
files with your own values.
Tip
You can generate a JWT secret by running the following command:
openssl rand -base64 32
- Install the dependencies:
pnpm install
- Start the development database:
docker-compose up -d postgres
- Initialize the database in one command:
pnpm --filter database db:init
Note
This will start prisma studio, where you can manage your database schema. For the next steps, you can close prisma studio or open a new terminal window/tab.
- Navigate back to the root directory and start the development server:
pnpm run dev
Note
The first time you run this command, it could take around 2 minutes as it fetches data from OSU's registrar.
The database is a Postgres database managed by Prisma. It is reachable through this connection: postgres://postgres:postgres@localhost:5432/beavbright
(or DATABASE_URL
in .env.local
).
Currently, the monorepo contains the following packages and applications:
database
: Prisma client shared by both theweb
andapi
appsui
: a React component library powered by shadcn/uieslint-config-custom
:eslint
configurations (includingeslint-config-next
andeslint-config-prettier
)tsconfig
: TypeScript configurations used throughout the monorepo
web
: a Next.js 14 appapi
: a Hono app
Script | Command | Description |
---|---|---|
build | turbo run build |
Compiles/transpiles project. |
dev | turbo run dev |
Starts development server. |
lint | turbo run lint |
Checks code quality. |
format | prettier --write "**/*.{ts,tsx,md}" |
Formats code files. |
ui:add | pnpm --filter ui ui:add |
Adds a new shadcn component. |
db:init | pnpm --filter database db:init |
Initializes the database. |
Command | Description |
---|---|
db:generate |
Generates Prisma client based on your Prisma schema. |
db:push |
Pushes the schema state to the database without running migrations. Useful for prototyping. |
db:init |
Initializes the database by installing dependencies, generating Prisma client, pushing the schema state to the database, seeding the database, and launching Prisma Studio. |
db:prod |
Deploys migrations in production. This is typically used to apply migrations in a production environment. |
db:studio |
Opens Prisma Studio, a visual editor for your database. |
db:migrate |
Runs migrations in development. This includes creating new migrations from changes in Prisma schema and applying them. |
db:postmigrate |
Generates Prisma client after running migrations. |
db:seed |
Executes the seed script to populate the database with initial data. |
db:scrape |
Updates the database with data directly from OSU. Use the -f flag to run the command forcefully. |
db:clean |
Resets the database by dropping all data and applying migrations from scratch. Uses --force to bypass safety checks. |
Thank you to dan5py for the original template. This allowed our club to build on top of it.
BeavBright is licensed under the MIT License - see the LICENSE file for details.