mirror of
https://github.com/fergalmoran/opengifame.git
synced 2025-12-22 09:38:44 +00:00
39ffac0eba626c3848c398e6218deb4c80ac17ac
OpenGifame - Image Sharing Platform
An open-source image sharing platform similar to Imgur, built with Next.js, Drizzle ORM, PostgreSQL, NextAuth, and shadcn/ui.
Features
- 🖼️ Image Upload & Sharing - Upload and share images with the community
- 👍 Voting System - Upvote and downvote images
- 💬 Comments - Comment on images with threaded replies
- 🏷️ Tagging System - Tag images and create new tags
- 📈 Trending Gallery - View trending images based on community votes
- 🔐 Authentication - Sign in with GitHub or Google
- 🌙 Dark/Light Mode - Responsive design with theme support
- 📱 Mobile Responsive - Works great on all devices
Tech Stack
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS, shadcn/ui components
- Database: PostgreSQL with Drizzle ORM
- Authentication: NextAuth.js
- Icons: Lucide React
- Package Manager: Bun
Getting Started
Prerequisites
- Node.js 18+ or Bun
- PostgreSQL database
- Git
Installation
-
Clone the repository
git clone <your-repo-url> cd opengifame -
Install dependencies
bun install -
Set up environment variables
cp .env.example .env.localEdit
.env.localand configure:# Database DATABASE_URL="postgres://postgres:hackme@localhost:5432/opengifame" # NextAuth NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="your-secret-key-here" # OAuth providers (optional) GITHUB_CLIENT_ID="your-github-client-id" GITHUB_CLIENT_SECRET="your-github-client-secret" GOOGLE_CLIENT_ID="your-google-client-id" GOOGLE_CLIENT_SECRET="your-google-client-secret" -
Set up the database
Create the PostgreSQL database:
CREATE DATABASE opengifame;Run the database migration:
bun run db:push -
Start the development server
bun run devOpen http://localhost:3000 in your browser.
Database Schema
The application uses the following main tables:
- users - User accounts (NextAuth)
- images - Uploaded images with metadata
- votes - User votes on images (upvote/downvote)
- comments - Comments on images with threading support
- tags - Image tags
- image_tags - Many-to-many relationship between images and tags
API Endpoints
POST /api/images/upload- Upload a new imagePOST /api/images/vote- Vote on an imageGET/POST /api/auth/[...nextauth]- NextAuth endpoints
Scripts
bun run dev- Start development serverbun run build- Build for productionbun run start- Start production serverbun run lint- Run ESLintbun run db:generate- Generate database migrationsbun run db:push- Push schema changes to databasebun run db:studio- Open Drizzle Studio
OAuth Setup (Optional)
GitHub OAuth
- Go to GitHub Settings > Developer settings > OAuth Apps
- Create a new OAuth App with:
- Homepage URL:
http://localhost:3000 - Authorization callback URL:
http://localhost:3000/api/auth/callback/github
- Homepage URL:
- Add the Client ID and Secret to your
.env.local
Google OAuth
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google+ API
- Create OAuth 2.0 credentials with:
- Authorized JavaScript origins:
http://localhost:3000 - Authorized redirect URIs:
http://localhost:3000/api/auth/callback/google
- Authorized JavaScript origins:
- Add the Client ID and Secret to your
.env.local
Project Structure
src/
├── app/ # Next.js app directory
│ ├── api/ # API routes
│ ├── upload/ # Upload page
│ ├── trending/ # Trending page
│ └── page.tsx # Home page
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── header.tsx # Navigation header
│ └── image-card.tsx # Image display component
├── lib/ # Utilities and configuration
│ ├── db/ # Database configuration and schema
│ ├── auth.ts # NextAuth configuration
│ └── utils.ts # Utility functions
└── types/ # TypeScript type definitions
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
License
This project is open source and available under the MIT License.
Deployment
The application can be deployed to any platform that supports Next.js:
- Vercel (recommended)
- Netlify
- Railway
- Docker
Make sure to:
- Set up environment variables in your deployment platform
- Configure a PostgreSQL database
- Set up OAuth providers for production URLs
Support
If you have any questions or issues, please open an issue on GitHub.
Description
Languages
TypeScript
96.2%
CSS
2.9%
JavaScript
0.9%