A stunning Pinterest-inspired image gallery application with a cosmic space theme. Built with Node.js, Express, and MongoDB, this platform allows users to create, share, and organize visual content in a beautiful, immersive interface.
- Image Upload & Management: Upload and showcase your visual content with support for various image formats
- User Authentication: Secure registration, login, and session management with bcrypt password hashing
- Post Creation: Create posts with titles, captions, images, and tags
- Social Interaction: Like and comment on posts from other users
- Search & Discovery: Search posts by title, caption, or tags with advanced filtering
- Tag System: Organize content with searchable tags and discover popular trends
- Profile Management: Customizable user profiles with bio and profile images
- Collections: Create and organize posts into personal collections
- Privacy Controls: Set collections as public or private
- Settings: Manage account preferences and profile information
- Responsive Design: Fully responsive interface that works on all devices
- Cosmic Theme: Beautiful space-themed design with animated star backgrounds
- Glass Morphism: Modern UI with glass-like effects and smooth animations
- Real-time Updates: Dynamic content loading and updates
- Node.js: JavaScript runtime environment
- Express.js: Web application framework
- MongoDB: NoSQL database for data storage
- Mongoose: MongoDB object modeling for Node.js
- EJS: Embedded JavaScript templating engine
- Multer: Middleware for handling file uploads
- Bcrypt: Password hashing for security
- Express Session: Session management
- Connect Flash: Flash messaging system
- Tailwind CSS: Utility-first CSS framework
- Font Awesome: Icon library
- Custom CSS: Space-themed styling with glass morphism effects
cosmic-gallery/
βββ app.js # Main application file
βββ bin/
β βββ www # Server startup script
βββ middleware/
β βββ auth.js # Authentication middleware
βββ models/
β βββ User.js # User schema and model
β βββ Post.js # Post schema and model
β βββ Collection.js # Collection schema and model
β βββ Comment.js # Comment schema and model
β βββ Like.js # Like schema and model
βββ routes/
β βββ index.js # Home page and search routes
β βββ users.js # User-related routes
βββ views/
β βββ partials/ # Reusable view components
β βββ index.ejs # Home page
β βββ login.ejs # Login page
β βββ signup.ejs # Registration page
β βββ profile.ejs # User profile page
β βββ create-post.ejs # Post creation page
β βββ edit-post.ejs # Post editing page
β βββ post-details.ejs # Individual post view
β βββ collections.ejs # Collections page
β βββ collection-details.ejs # Collection details
β βββ search.ejs # Search results page
β βββ settings.ejs # User settings page
β βββ error.ejs # Error page
βββ public/
β βββ css/ # Custom stylesheets
β βββ uploads/ # User uploaded content
β β βββ profiles/ # Profile images
β β βββ posts/ # Post images
β βββ stylesheets/ # Additional styles
βββ package.json # Dependencies and scripts
βββ package-lock.json # Dependency lock file
- Node.js (v14 or higher)
- MongoDB (local or MongoDB Atlas)
- Git
-
Clone the repository
git clone <repository-url> cd cosmic-gallery-main
-
Install dependencies
npm install
-
Environment Setup
- Create a MongoDB database
- Set up your MongoDB connection URI
- For production: Store your MongoDB URI in
/etc/secrets/MONGODB_URI - For development: Modify the connection in
app.js
-
Start the application
npm start
-
Access the application Open your browser and navigate to
http://localhost:3000
The application connects to MongoDB using the connection URI specified in /etc/secrets/MONGODB_URI. For local development, you can modify the connection logic in app.js.
- Profile Images: 5MB maximum size
- Post Images: 10MB maximum size
- Supported Formats: All image formats (validated by MIME type)
- Sessions are stored in memory (for development)
- Session secret: 'secret' (change for production)
- Session timeout: Browser session
GET /login- Login pagePOST /login- Authenticate userGET /signup- Registration pagePOST /signup- Create new userGET /logout- Logout user
GET /- Home page with posts feedGET /post/create- Create new post pagePOST /post/create- Submit new postGET /post/:id/edit- Edit post pagePOST /post/:id/edit- Update postPOST /post/:id/delete- Delete postGET /post/:id- View post detailsPOST /post/:id/like- Like/unlike postPOST /post/:id/comment- Add comment to post
GET /profile/:id- View user profileGET /profile/:id/edit- Edit profile pagePOST /profile/:id/edit- Update profileGET /settings- User settings page
GET /collections- View all collectionsGET /collection/:id- View collection detailsPOST /collection/create- Create new collectionPOST /collection/:id/add-post- Add post to collection
GET /search- Search pageGET /?q=query- Search posts with queryGET /?tag=tagname- Filter posts by tag
- Primary: Deep space blues and purples
- Background: Gradient from dark blue to purple
- Glass Effect: Semi-transparent overlays with blur
- Text: Light colors for contrast against dark theme
- Navigation: Sticky glass-morphism header
- Cards: Glass-effect post cards with hover animations
- Buttons: Smooth transitions and hover states
- Forms: Clean, modern input fields with validation
- Modals: Overlay dialogs for interactions
- Password Hashing: All passwords are hashed using bcrypt
- Session Management: Secure session handling
- File Upload Validation: MIME type checking and size limits
- Input Sanitization: Protection against XSS attacks
- Authentication Middleware: Protected routes for logged-in users
For production deployment, ensure the following:
- MongoDB connection URI is securely stored
- Session secret is changed from default
- File upload directories have proper permissions
- Error handling is configured for production
- Backend: Heroku, DigitalOcean, or AWS
- Database: MongoDB Atlas for cloud hosting
- Static Files: CDN for uploaded content
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Inspired by Pinterest's grid layout and user experience
- Built with modern web technologies and best practices
- Cosmic theme designed for an immersive visual experience
Created with β€οΈ and a touch of cosmic magic β¨π