A bare-bones social media website created using React to render the front-end view and an Express server connected to a MongoDB instance to handle read/writes to the database.
- Login and logout through JSON Web Token validation
- Read and write posts through HTTP GET and POST requests to the backend
- Delete posts if the post belongs to the user
Name | Data Type | Description |
---|---|---|
id |
ObjectId | MongoDB data type |
name |
String | Username of the poster |
text |
String | Post text |
Name | Data Type | Description |
---|---|---|
username |
String | |
hash |
String | password encrypted with bcrypt |
- Navigate to the
client
directory npm install
to install dependenciesnpm run start
to start the React app
- Navigate to the
server
directory - Create a
.env.
file with the following fields
MONGODB_URI={MONGODB_URI} // connection string for connecting to MongoDB cloud instance
DB_NAME={DB_NAME} // name of your MongoDB subdirectory
PORT={PORT} // port server is hosted at
JWT_SECRET_KEY={JWT_KEY} // JSON Web Token key used for verifying user requests
ALLOWED_ORIGIN // only requests from this origin are allowed
npm install
to install dependenciesnode server.js
to run the server
Check it out live here!
- Please be patient as the app is currently hosted on Render's free tier plan which has an abnormally long wind up time. Thanks!
- Sort posts by name, date & more
- Edit existing posts
- Move rendering to server side with Next.js?
- Move server endpoints to
/api
route and serve static client files from/