Skip to content

Instantly share code, notes, and snippets.

@bemorr
Last active February 25, 2024 12:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bemorr/ce378a884f95e5891f2526ccdce687e3 to your computer and use it in GitHub Desktop.
Save bemorr/ce378a884f95e5891f2526ccdce687e3 to your computer and use it in GitHub Desktop.
A high level checklist for building a product from scratch

Checklist: Building a Product from Scratch

What to ensure is setup & considered when building from scratch.

How many types of user ? :

  • Visitors - can only view the homepage
  • Logged In User - can only view the their page
  • Admin User - can view any page; can de-activate users;

Language & Framework choice

  • JS
  • Vue

Implement Authentication and authorisation microservices

Authentication

  • Add auth router
  • Create user with POST /auth/signup
    • validate required fields
    • Check if email is unique
    • hash password with bcrypt
    • insert into db
    • Set a cookie with user_id after creating user
      • Best Practices
      • Cross origin cookie!
  • Create sign up form; show errors; redirect;
    • Validate required fields
  • Login user with POST /auth/login
    • check if email in db
      • compare password with hashed password in db
      • set cookie
  • Create login form; show errors; redirect;
    • validate required fields

Authorization:

  • Visitors can only see the homepage
    • create middleware to redirect visitors without a user_id cookie set
    • redirect to sign up form and show an error message
  • Logged in users can only see their page
    • check user_id cookie in route handler
    • show an unauthorized error message
    • redirect to user page if they visit the homepage

Admin Page:

  • Admin page that lists all users
    • admin table with user_id (unique constraint)
    • de-activate users
  • Admin can see any page on site

Other ways to auth:

  • Use sessions instead of cookies!
  • Use JWTs instead of sessions!

Create an abstract base model to be inherited by every other model in your database

Set up a notification microservice

  • Push Notifications (APNS + FCM),
  • Emails (just integrate an SMTP client for starting)
  • SMS

*NOTE - Have two channels for sending SMS, transactional and promotional. Never send a promotional SMS on a transactional channel, as there are chances that you will be sued by a well informed and motivated user.

Set up error logging

  • Airbrake / sentry

Implement request - response and application logging

*NOTE - While logging request and responses, take care of the following: Do not log passwords. Do not log tokens (the access tokens which are used for Authentication) Do not log OTPs

Introduce throttling in your APIs and rate limiting on your application servers

Establish and configure asynchronous communication.

Set up cron/launchd jobs

Scenario - You just launched your product and you need to send recommendations to your users about new products on your platform. You'll send these on the basis of their purchase history each weekend.

Manage your secrets properly (parameters file)

Version your APIs from day one

Decide on hard and soft update version checks for your front end clients

So what's the difference between hard and soft updates?

Hard updates refer to when the user is forced to update the client version to a higher version number than what is installed on their mobile.

Soft updates refer to when the user is shown a prompt that a new version is available and they can update their app to the new version if they want to.

Introduce continuous integration (CI) from day one

There are a lot of options available in the market. You can either chose to implement one on your own (Jenkins CI/CD), or you can use TravisCI, CircleCI, etc for the same.

Optional

Enable Docker support (personal preference)

Create a Dockerfile and docker-compose.yml for your application so that everyone runs the application using Docker from the start. One of the main reasons to use such an approach is to have consistency across your local/staging/production environment, so that no developer can ever say this again:

Use an APM tool

An Application Monitoring Tool is a must have if you want to monitor your application's APIs, transactions, database connections, and so on.

Use ElasticSearch to power application-wide searches in your client apps

Here's a good overview of Elasticsearch to get you started: https://www.freecodecamp.org/news/go-elasticsearch/

And the ElasticSearch Docs - https://www.elastic.co/guide/index.html

Put a firewall in your production server

  • close all the ports except the ones to be used for APIs (https connections)
  • Route the API endpoints using a reverse proxy web server, like NGiNX or Apache

Run app through Google Lighthouse to test for accessibility


**NOTES Why you should use NGiNX: https://www.nginx.com/resources/wiki/community/why_use_it/ https://blog.serverdensity.com/why-we-use-nginx/ https://www.freecodecamp.org/news/an-introduction-to-nginx-for-developers-62179b6a458f/

Ref: https://www.freecodecamp.org/news/have-an-idea-want-to-build-a-product-from-scratch-heres-a-checklist-of-things-you-should-go-through-in-your-backend-software-architecture/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment