A modern, feature-rich social feed application built as an experiment with GitHub's spec-kit methodology.
PostShare was created to explore and demonstrate the spec-kit development approach - a specification-driven workflow that emphasizes:
- Specification-first development: Features are fully specified before implementation
- Structured planning: Each feature has detailed research, data models, and task breakdowns
- Incremental delivery: Features are implemented as independent, testable units
- Documentation-driven: All features are documented in
/specswith specifications, plans, and contracts
This project serves as a real-world example of how spec-kit can streamline the development process from idea to implementation.
PostShare is a complete social feed platform with the following capabilities:
- π Create Posts: Write and share posts with text content
- πΌοΈ Image Support: Attach images to posts with automatic compression (<300KB)
- βοΈ Edit Posts: Modify post content and images after publishing
- ποΈ Delete Posts: Remove individual posts or clear entire feed
- ποΈ View Images: Click images to view in full-screen modal
- π Dark Mode: Toggle between light and dark themes with system preference sync
- π JWT Authentication: Secure token-based authentication with access and refresh tokens
- π§ Email/Password Signup & Login: Traditional authentication with strong password requirements
- π Google OAuth: Sign in with Google for seamless authentication
- π GitHub OAuth: Sign in with GitHub for developer-friendly login
- π Account Linking: Automatically links OAuth and password authentication methods
- π‘οΈ Protected Routes: Route-level authentication guards for secure access
- π Automatic Token Refresh: Seamless session management with refresh token rotation
- π« Rate Limiting: Login attempt throttling with account lockout protection
- πΎ Database Storage: MongoDB with Vercel integration for persistent data
- π Full-Stack Architecture: Express backend API + React frontend
- π± Responsive Design: Beautiful UI that works on all screen sizes
- π¨ Image Optimization: Automatic compression using
browser-image-compression - β¨ Modern UI: Glassmorphism effects, smooth animations, gradient accents
- β‘ Real-time Updates: Optimistic UI updates without page reloads
- π Complete Dark Mode: Full dark theme support across all pages and components
- Framework: React 18+ with Vite
- Styling: Tailwind CSS with custom design system
- Routing: React Router DOM v6
- Icons: Lucide React
- Image Processing: browser-image-compression
- State Management: React Context API
- Runtime: Node.js 18+ with Express
- Database: MongoDB with connection pooling
- Authentication: JWT (jsonwebtoken) + OAuth 2.0
- Password Hashing: bcrypt
- Image Storage: Cloudinary integration
- Environment: dotenv for configuration
- Platform: Vercel (serverless functions)
- Database: MongoDB Atlas
- CDN: Cloudinary for image hosting
PostShare/
βββ api/ # Backend API routes (Vercel serverless)
β βββ auth/
β β βββ login.js
β β βββ signup.js
β β βββ refresh.js
β β βββ logout.js
β β βββ oauth/
β β βββ google.js
β β βββ github.js
β β βββ [provider]/callback.js
β βββ posts/
β βββ images/
βββ lib/ # Shared utilities
β βββ auth.js # JWT & password hashing
β βββ mongodb.js # Database connection
β βββ cloudinary.js # Image upload
β βββ errors.js # Error handling
β βββ middleware.js # Request validation
βββ src/
β βββ components/ # React components
β β βββ Navbar.jsx
β β βββ PostCard.jsx
β β βββ PostForm.jsx
β β βββ EditPostModal.jsx
β β βββ ImageModal.jsx
β β βββ ProtectedRoute.jsx
β βββ pages/ # Route pages
β β βββ Feed.jsx
β β βββ CreatePost.jsx
β β βββ Login.jsx
β β βββ Signup.jsx
β β βββ OAuthCallback.jsx
β βββ services/ # API client
β β βββ apiClient.js
β βββ contexts/ # React Context
β β βββ AuthContext.jsx
β βββ hooks/ # Custom hooks
β βββ useAuth.js
βββ specs/ # Feature specifications
β βββ 001-static-blog-page/
β βββ 002-clear-feed/
β βββ 003-ui-revamp-theme/
β βββ 004-delete-post-image-opt/
β βββ 005-view-edit-feed/
β βββ 006-vercel-db-storage/ # β Authentication & Database
βββ .specify/ # spec-kit configuration
- Node.js 18+ and npm
- MongoDB Atlas account (free tier works)
- Google OAuth credentials (optional, for Google login)
- GitHub OAuth app (optional, for GitHub login)
- Cloudinary account (for image uploads)
-
Clone the repository
git clone <repository-url> cd PostShare
-
Install dependencies
npm install
-
Set up environment variables
Create a
.env.localfile in the root directory:# Database MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/postshare # JWT Secret (generate a random string) JWT_SECRET=your-super-secret-jwt-key-change-this-in-production # OAuth - Google (optional) GOOGLE_CLIENT_ID=your-google-client-id GOOGLE_CLIENT_SECRET=your-google-client-secret # OAuth - GitHub (optional) GITHUB_CLIENT_ID=your-github-client-id GITHUB_CLIENT_SECRET=your-github-client-secret # Cloudinary (for image uploads) CLOUDINARY_CLOUD_NAME=your-cloud-name CLOUDINARY_API_KEY=your-api-key CLOUDINARY_API_SECRET=your-api-secret
-
Initialize the database
node lib/initDb.js
-
Start development servers
For local development with OAuth:
# Terminal 1: Start backend API node start-server.js # Terminal 2: Start frontend dev server npm run dev
Or use Vercel's dev environment:
vercel dev
-
Open your browser Navigate to
http://localhost:5174(or port shown in terminal)
npm run dev- Start Vite development server (frontend only)node start-server.js- Start Express backend server (port 3000)vercel dev- Start full-stack dev environment (recommended)npm run build- Build for productionnpm run preview- Preview production build locallynpm run lint- Run ESLint
Google OAuth:
- Go to Google Cloud Console
- Create a new project
- Enable Google+ API
- Create OAuth credentials
- Add to authorized redirect URIs:
http://localhost:3000/api/auth/oauth/google/callback(local)- Your production URL
GitHub OAuth:
- Go to GitHub Settings β Developer settings β OAuth Apps
- Create a new OAuth app
- Set authorization callback URL:
http://localhost:3000/api/auth/oauth/github/callback(local)- Your production URL
Each feature in PostShare follows the spec-kit workflow:
Define what the feature should do from a user perspective:
- User stories and acceptance criteria
- Success metrics
- Functional requirements
Technical design and architecture:
- Research decisions
- Data models
- API contracts
- Implementation structure
Break down into actionable tasks:
- Phase-based organization
- Dependency tracking
- Parallel execution opportunities
Execute tasks systematically:
- Sequential and parallel task execution
- Validation at each phase
- Progress tracking
specs/005-view-edit-feed/
βββ spec.md # User-facing specification
βββ plan.md # Technical implementation plan
βββ research.md # Technology decisions
βββ data-model.md # Data structure design
βββ contracts/ # API interfaces
β βββ BlogService.ts
βββ quickstart.md # Testing guide
βββ tasks.md # Implementation checklist
- 001-static-blog-page: Initial post feed and creation (LocalStorage)
- 002-clear-feed: Bulk delete functionality
- 003-ui-revamp-theme: Dark mode and modern design system
- 004-delete-post-image-opt: Single post deletion + image compression
- 005-view-edit-feed: Image viewing modal + post editing
- 006-vercel-db-storage: Full authentication system β
- MongoDB database integration
- JWT authentication with refresh tokens
- Email/password signup & login
- Google OAuth 2.0 integration
- GitHub OAuth 2.0 integration
- Account linking (OAuth β password)
- Protected routes & session management
- Rate limiting & security features
- β Clear scope: Each feature has well-defined boundaries
- β Better planning: Design decisions documented before coding
- β Easier debugging: Specifications provide reference for expected behavior
- β Incremental progress: Features can be developed independently
- β Self-documenting: Specs serve as living documentation
- π Initial overhead in creating detailed specifications
- π Learning curve for the workflow commands
- π Maintaining consistency across specification documents
This is an experimental project, but contributions are welcome! Please:
- Follow the spec-kit workflow for new features
- Create a specification before implementing
- Update relevant documentation
- Ensure all tasks are completed
This project is open source and available for learning purposes.
- spec-kit by Google for the specification-driven development methodology
- Tailwind CSS for the utility-first CSS framework
- Vite for blazing-fast development experience
- Lucide for beautiful icons
Note: This project was built entirely using the spec-kit methodology as an experiment in specification-driven development. Each feature was carefully planned, documented, and implemented following the workflows provided by spec-kit.