Skip to content
All work

Learning build · 2022

Mern Memories

A social feed of photo memories — posts, tags, likes and editing — built to learn the MERN stack end to end, from the Mongoose schema to the Redux store.

Role
Full-stack
Stack
MongoDBExpressReactNode.jsReduxMaterial UI
Live
mern-mermories.vercel.app
Source
GitHub
The memories feed with a create form above it

01What the build involved

01

One schema, the whole feed

A memory is a title, a message, a creator, a list of tags, a base64 image and a list of user ids that liked it, all in one Mongoose model. The Express routes follow the data: list everything in public, then create, edit, delete and like behind an auth middleware. Likes are stored as ids rather than a counter, so the same person cannot like a post twice and the number is always a length, never a number that can drift.

02

Two tokens, one middleware

Sign-in issues a JWT signed with a secret, and the client can also sign in with Google through react-google-login. Rather than two middleware paths, the auth file looks at the token: short means my own JWT and it verifies the signature, long means a Google ID token and it decodes the subject instead. It worked, and it taught me why relying on token length is a shortcut — today I would name the issuer in the request and verify each one properly.

03

State kept in one place

The client is split into api, actions, reducers and components, with Redux and redux-thunk handling every fetch, so the feed, the edit form and the like button all read the same store. Material UI cards and a moment-formatted timestamp do the presentation. Half the value of the project was the folder structure: learning where a request belongs before writing it.

02What it left behind

Outcome

A complete MERN exercise live at mern-mermories.vercel.app: sign-up, sign-in, create, edit, delete, like and search, with the Express routes, the JWT middleware and the Redux store forming one request path instead of separate tutorials.

Another pass

Base64 images inside the document were fine for a demo and wrong for anything real — uploads belong in object storage with a URL on the schema. The middleware that guesses the token type from its length is the other shortcut I would replace: name the issuer on the request and verify each kind properly.

03Inside the product

One auth screen covers both token types: an email and password form for the app’s own JWT, and a Google button that returns an ID token to the same middleware.
Registration collects the name that appears on every card the person posts. Likes are stored as user ids, so the count is always the length of that list.

Click any screenshot to view it full size

Next case study

DigiLife Magazine

My first project at KodeGo: a magazine and digital-services site in plain HTML, CSS and JavaScript, with a page per section and a page per writer.