Table of Contents
Full-stack social web application focused on images, created using the MERN stack with MaterialUI and ReactQuery for state management. The app allows users to create an account, upload, share and comment on images. Users can also follow each others, like images and comments.
It provides a platform for users to connect and engage with others who share similar interests in photography, art, and design. With the search function, users can search for images based on tags.
The pro version provides additional features for users to upload GIFs and have priority in search results. Users can create more dynamic and engaging posts with the use of GIFs, which can help to grab the attention of other users. Pro allows to set a banner image that appears on their profile page, creating a more personalized and professional look for their profile. Users can also upload an avatar image in the form of GIFs.
Front-end:
Back-end:
To properly run this application, you'll need Node.js and npm installed on your machine. Additionally, you'll need Docker Desktop to run databases in a containerized environment.
You need to clone the repository, install npm packages and create all essential files. Everything is listed below.
-
Clone the repository.
git clone https://github.com/LeCarteloo/Imaggy.git
-
Create .env file in server/config directiory, it will be used in docker-compose.yaml and docker.sh.
# Project name COMPOSE_PROJECT_NAME=imaggy # Mongo db env variables USERNAME=<username> PASSWORD=<password> DATABASE=imaggy # Mongo test db env variables TEST_USERNAME=<test_username> TEST_PASSWORD=<test_password> TEST_DATABASE=imaggy-test
-
Create mongo-init.js file inside server/config directory.
db.createUser({ user: '<username>', pwd: '<password>', roles: [ { role: 'readWrite', db: 'imaggy', }, ], });
-
Create mongo-test-init.js file inside server/config directory.
db.createUser({ user: '<test_username>', pwd: '<test_password>', roles: [ { role: 'dbOwner', db: 'imaggy-test', }, ], });
-
Open Docker Desktop and run docker.sh script located in server/config, it will create new container with two images of MongoDB. One for test and one for development.
-
Head to server directory and install all needed dependencies.
npm install
-
Create .env file in server directory.
# Server and node config NODE_ENV=development PORT=<port | 3000> # Mongo database config MONGO_URI=localhost:27017 MONGO_USER=<username> MONGO_PASS=<password> MONGO_DB=imaggy # JWT secret key and expiration time JWT_SECRET=<secret_key> JWT_LIFE=<lifetime | 12h> # JWT refresh secret key and expiration time JWT_REF_SECRET=<refresh_secret_key> JWT_REF_LIFE=<refresh_lifetime | 30d>
-
Create .env-test file in server directory.
# Server and node config NODE_ENV=testing PORT=<port | 5000> # Mongo database config MONGO_URI=localhost:27018 MONGO_USER=<test_username> MONGO_PASS=<test_password> MONGO_DB=imaggy-test # JWT secret key and expiration time JWT_SECRET=<test_secret_key> JWT_LIFE=<test_lifetime | 6h> # JWT refresh secret key and expiration time JWT_REF_SECRET=<test_refresh_secret_key> JWT_REF_LIFE=<test_refresh_lifetime | 12h>
-
Head to client directory and install all needed dependencies.
npm install
-
*If you changed default port of server, go to client/api directory and change BASE_URL to inside axios.ts file.
const BASE_URL = 'http://localhost:<port | 3000>/api';
To use this application, databases (images in Docker), client and server must be running together.
- To run client in development mode
npm run dev
- To build and run client
npm run build npm run preview
- To run server (it will be autmatically built)
npm run dev
- Or run it from build by running
npm run build npm start
Make sure your Docker is running.
- To run unit tests in both server and client environments
npm test
- LinkedIn - @filip-papiernik
- Email - [email protected]