Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌌 Cosmic Gallery

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.

✨ Features

🎨 Core Functionality

  • 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

πŸ‘€ User Features

  • 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

🎯 User Experience

  • 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

πŸ› οΈ Technology Stack

Backend

  • 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

Frontend

  • Tailwind CSS: Utility-first CSS framework
  • Font Awesome: Icon library
  • Custom CSS: Space-themed styling with glass morphism effects

File Structure

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

πŸš€ Installation & Setup

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local or MongoDB Atlas)
  • Git

Installation Steps

  1. Clone the repository

    git clone <repository-url>
    cd cosmic-gallery-main
  2. Install dependencies

    npm install
  3. 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
  4. Start the application

    npm start
  5. Access the application Open your browser and navigate to http://localhost:3000

πŸ”§ Configuration

Database Configuration

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.

File Upload Limits

  • Profile Images: 5MB maximum size
  • Post Images: 10MB maximum size
  • Supported Formats: All image formats (validated by MIME type)

Session Configuration

  • Sessions are stored in memory (for development)
  • Session secret: 'secret' (change for production)
  • Session timeout: Browser session

πŸ“š API Endpoints

Authentication

  • GET /login - Login page
  • POST /login - Authenticate user
  • GET /signup - Registration page
  • POST /signup - Create new user
  • GET /logout - Logout user

Posts

  • GET / - Home page with posts feed
  • GET /post/create - Create new post page
  • POST /post/create - Submit new post
  • GET /post/:id/edit - Edit post page
  • POST /post/:id/edit - Update post
  • POST /post/:id/delete - Delete post
  • GET /post/:id - View post details
  • POST /post/:id/like - Like/unlike post
  • POST /post/:id/comment - Add comment to post

User Profile

  • GET /profile/:id - View user profile
  • GET /profile/:id/edit - Edit profile page
  • POST /profile/:id/edit - Update profile
  • GET /settings - User settings page

Collections

  • GET /collections - View all collections
  • GET /collection/:id - View collection details
  • POST /collection/create - Create new collection
  • POST /collection/:id/add-post - Add post to collection

Search

  • GET /search - Search page
  • GET /?q=query - Search posts with query
  • GET /?tag=tagname - Filter posts by tag

🎨 Design System

Color Palette

  • 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

UI Components

  • 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

πŸ”’ Security Features

  • 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

πŸš€ Deployment

Environment Variables

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

Recommended Hosting

  • Backend: Heroku, DigitalOcean, or AWS
  • Database: MongoDB Atlas for cloud hosting
  • Static Files: CDN for uploaded content

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ™ Acknowledgments

  • 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 ✨🌌

Releases

Packages

Used by

Contributors

Languages