A more than chronological way of sharing with friends, family, and private communities.
Users can create moons. Once created, a user can share a unique code to join that moon. Anyone with the code will be able to join. The creator of a moon will become the mission commander. Only mission commander can destroy moons.
Anyone astronaut invited onto a moon can create rooms. Think of rooms like a category of ideas. For example, a user might create rooms to share recipes, favorite wines, music, and videogames with their friends.
Anyone on a moon can create posts. Posts will be un-categorized by default, but the user can choose to post to a specific room, recipes for example.
Let's say I want to share a recipe with my family moon. I'll click the new post button, select the recipes room (created earlier), give my post a title, link, description, rating, and tags, then post the recipe.
When creating a post, a user can add tags to the post. For example, if sharing a recipe, you might want to tag it [dairy-free
, easy
, healthy
]
These tags make searching and filtering posts easier for other members of the moon.
Once a moon contains posts, and possibly rooms, users can easily search and filter all posts by different parameters. This makes it easy to find anything shared in the moon.
This repo extends my fullstack-auth-docker-boilerplate - a monolithic, containerized, boilerplate repo for kickstarting fullstack applications. The boilerplate code sets up an authentication API using google login OAuth2 with users saved to a Mongo database. It exposes an Apollo graphQL server for querying and mutating data. This repo also sets up a simple front-end which includes persistent login with google, protected routes, and login / logout auth token management.
The client, server, and database are then containerized using the docker-compose.yml
file. Once you've installed docker, you can spin up the the development environment with two simple commands.
docker-compose build
docker-compose up
- (when you've finished)
docker-compose down
Create .env file in both the /server
folder and root folder of the repository with the following fields.
Key | Value |
---|---|
PORT | 5000 |
DB_USER | username |
DB_PASSWORD | password |
GOOGLE_CLIENT_ID | client ID from console.cloud.google.com |
JWT_SECRET | any string that is complex and not easy to guess / brute force |
If developing on Windows, you must also create a .env file inside the /client
directory with one entry
Key | Value |
---|---|
CHOKIDAR_USEPOLLING | true |
- Navigate to here, download and install docker desktop
- Navigate to console.cloud.google.com
- Create new project
- In navigation menu, go to APIs & Services -> Credentials
- Create credentials -> OAuth client ID
- Follow steps and copy google client ID into both the .env & component
- Navigate to the root project directory (where docker-compose.yml is located)
- Once docker-desktop is installed, run
docker-compose build
. This will build the the following images for your app- lightweight mongo database server (port 27017 by default)
- lightweight node server for API and graphql (port 5000 by default)
- lightweight node server for serving create-react-app client build (port 3000 by default)
- To start, run
docker-compose up
- To stop, run
docker-compose down
Once containers are running, navigate to http://localhost:5000/graphql
to play around with your API and make test queries.
*Note 5000
should be replaced with the port you set in the .env file. Also, because the API is protected by authentication middleware, you won't be able to access the graphql playground unless your requests contain a valid valid Authorization: Bearer [token]
. To get a valid token, you can log the token returned from the /auth/googleLogin
API call on the frontend. You can also view the client localStorage
session key and copy the token from there. Once you have the token, paste it into the HTTP header section of the graphql playground.