Skip to content

A community-driven hub for collaboration, tailored for Oregon State University students.

License

Notifications You must be signed in to change notification settings

OSU-App-Club/beavbright

Repository files navigation

[BeavBright Preview Image]

BeavBright 🦫✨

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.

Contributors 🤝

Contributors

Tech Stack 🚀

  • 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

Getting Started 🏁

Prerequisites

  • 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)
  1. Clone the repository:
git clone https://github.com/OSU-App-Club/beavbright.git
  1. Install the following:
pnpm install -g dotenv-cli
  1. Create your .env.local files in the packages/database and apps/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
  1. Install the dependencies:
pnpm install
  1. Start the development database:
docker-compose up -d postgres
  1. 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.

  1. 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.

Database

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).

What's inside? 🤔

Currently, the monorepo contains the following packages and applications:

Packages 📦

  • database: Prisma client shared by both the web and api apps
  • ui: a React component library powered by shadcn/ui
  • eslint-config-custom: eslint configurations (including eslint-config-next and eslint-config-prettier)
  • tsconfig: TypeScript configurations used throughout the monorepo

Applications 🚀

Notable Scripts 📜

Global Scripts

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.

Database Scripts

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.

Credits 🙏

Thank you to dan5py for the original template. This allowed our club to build on top of it.

License 📝

BeavBright is licensed under the MIT License - see the LICENSE file for details.

About

A community-driven hub for collaboration, tailored for Oregon State University students.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages