Skip to content

🌄 A simple image hosting service implemented using Node.js + Express + MongoDB + Redis

Notifications You must be signed in to change notification settings

Coteh/simpleimage

 
 

Repository files navigation

simpleimage logo

CircleCI

A simple image hosting web application that I created and implemented using Node.js and Express, with MongoDB as the database and Redis as the session store for production.

Screenshot

Features

  • Upload BMP, PNG, JPEG, and GIF images
  • Comment on images
  • Image page
    • Image upload date
    • Total number of comments on image
  • Delete your images (Must have an account)
  • User profile page
    • Join date
    • Comment history and total number of comments posted
  • Rotates JPEG images based on Orientation tag in EXIF metadata
  • Strips EXIF metadata from JPEG images

Installation

.env Template

MONGODB_URI=<MongoDB URI goes here>
REDIS_URL=<Redis URL goes here>
MONGO_ROOT_USERNAME=<root username for MongoDB instance>
MONGO_ROOT_PASSWORD=<root password for MongoDB instance>
MONGO_INITIAL_DATABASE=<initial database for MongoDB instance>

SESSION_SECRET=<session secret goes here>

Building and Running Locally

# Install dependencies
npm install

# Build web components with webpack (and watch for changes when in development mode)
npm run build:client

# Run local MongoDB database
mongod --dbpath ./data/

# Export SESSION_SECRET environment variable (or use a .env file)
export SESSION_SECRET="my-secret"

# Run the app
npm start
# or, run the app in development mode
npm run start:dev

# Navigate to http://localhost:3010 on your browser

Serving with Docker (in development)

# Build Docker images
docker-compose -f docker-compose.yml -f docker-compose.dev.yml build
# or, run
make build-dev

# Run Docker containers in Docker Compose environment
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
# or, run
make deploy-dev

# Navigate to http://localhost:8080 on your browser

Serving with Docker (in production)

# Build Docker images
docker-compose build
# or, run
make build-prod

# Run Docker containers in Docker Compose environment
docker-compose up
# or, run
make deploy-prod

Run Tests

# Build Docker images for test
docker-compose -f docker-compose.yml -f docker-compose.test.yml build
# or, run
make build-test

# Run Docker containers for test in Docker Compose environment
docker-compose -f docker-compose.yml -f docker-compose.test.yml up --abort-on-container-exit
# or, run
make deploy-test

Known Limitations

  • Cannot change username/password/email
  • Some of the popup dialogs need a bit of size tweaking (e.g. signup dialog)
  • No image upload history (Currently being worked on in dev/image-history branch)
  • No option for anonymous users to upload an image with ability to delete
    • Delete links based on user session are being considered (which is what imgur does as well)
  • See Issues page for more

Future Additions

  • User preferences menu
  • Ability to change email and/or username
  • Image galleries
  • Custom image IDs
  • Delete account

About

🌄 A simple image hosting service implemented using Node.js + Express + MongoDB + Redis

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published