A modern image gallery application built with Next.js, primarily as a learning project to explore Next.js features and capabilities.
- User Authentication: Secure user login and session management using NextAuth.js.
- Image Uploads: Upload and manage images seamlessly with UploadThing.
- Album Management: Create and organize images into custom albums.
- Responsive Gallery: A beautiful, responsive grid layout for viewing images and albums.
- Interactive UI: Built with React, TypeScript, and Tailwind CSS for a smooth user experience.
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS
- Authentication: NextAuth.js
- Database: Prisma with PostgreSQL
- Image Upload: UploadThing
- State Management: Zustand
- UI Components: Custom components with clsx for conditional styling
- Node.js 18 or later
- npm, yarn, pnpm, or bun
-
Clone the repository:
git clone https://github.com/Gnkalk/negarkhone.git cd negarkhone -
Install dependencies:
npm install # or yarn install # or pnpm install # or bun install
-
Set up the database:
npx prisma generate npx prisma db push
-
Configure environment variables: Create a
.env.localfile in the root directory and add the following:NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET=your-secret-key UPLOADTHING_SECRET=your-uploadthing-secret UPLOADTHING_APP_ID=your-uploadthing-app-id GITHUB_CLIENT_ID=your-github-client-id GITHUB_CLIENT_SECRET=your-github-client-secret
You can generate a secret for NextAuth with:
openssl rand -base64 32
-
Run the development server:
npm run dev # or yarn dev # or pnpm dev # or bun dev
-
Open http://localhost:3000 with your browser to see the result.
negarkhone/
├── app/ # Next.js app directory
│ ├── _components/ # React components
│ ├── api/ # API routes
│ ├── auth.ts # NextAuth configuration
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Home page
│ └── server/ # Server-side utilities (queries, actions, db)
├── public/ # Static assets
├── tailwind.config.ts # Tailwind CSS configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project dependencies and scripts
- GalleryControls: Manages gallery view and filtering.
- UploadComponent: Handles image uploads.
- SingleImage: Displays individual images.
- CreateAlbumButton: UI for creating new albums.
- Account: User account management component.
/api/auth/[...nextauth]: Handles authentication./api/uploadthing/: Manages image upload endpoints.
The application uses Prisma to manage the database schema. The main entities are:
User: Stores user information.Image: Stores image metadata and URLs.Album: Stores album information and relationships to users and images.
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out the Next.js deployment documentation for more details.
- Docker: You can create a Dockerfile for containerized deployment.
- Traditional Servers: Deploy using Node.js on services like AWS, Google Cloud, or DigitalOcean.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add some amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
- Next.js for the React framework.
- Tailwind CSS for utility-first CSS.
- Prisma for the database ORM.
- UploadThing for file uploads.
- NextAuth.js for authentication.