OpenShelf is a web application for university students to share used books. It facilitates the donation and request of textbooks, promoting sustainability and accessibility in education.
- User Authentication: Secure login and registration using NextAuth.js (Credentials & Google).
- Book Listings: Students can list books they want to donate with details like title, author, condition, and images.
- Search & Browse: Powerful search and filtering options to find specific books by category, condition, or location.
- Request System: Students can request available books and initiate a conversation with the donor.
- Messaging: Built-in messaging system for donors and requesters to coordinate pickup.
- Dashboard: personalized dashboard for students to manage their listings, requests, and messages.
- Admin Panel: Administrative tools to manage users, listings, and monitor platform activity.
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- Database: PostgreSQL
- ORM: Prisma
- Authentication: NextAuth.js v5
- UI Components: Radix UI (via shadcn/ui pattern)
- Node.js 18+
- PostgreSQL database
-
Clone the repository:
git clone https://github.com/yourusername/openshelf.git cd openshelf -
Install dependencies:
npm install
-
Set up environment variables:
Copy
.env.exampleto.envand fill in the required values.cp .env.example .env
Required variables:
DATABASE_URL: Connection string for your PostgreSQL database.AUTH_SECRET: A random string for NextAuth security.AUTH_URL: The base URL of your app (e.g.,http://localhost:3000).AUTH_GOOGLE_ID&AUTH_GOOGLE_SECRET: (Optional) For Google Sign-In.
-
Initialize the database:
npx prisma migrate dev --name init npx prisma db seed
-
Run the development server:
npm run dev
Open http://localhost:3000 with your browser.
src/app: Next.js App Router pages and layouts.src/components: Reusable UI components.src/lib: Utility functions, Prisma client, and server actions.prisma: Database schema and seed script.
Contributions are welcome! Please open an issue or submit a pull request.