4
4 Comments

How do you structure your SaaS codebase?

Hi everyone! I am currently researching which tech stack should I use for my SaaS application. I'm quite familiar with the .Net Stack and during the last couple of months i've been working on a React Native app, which is due to be released for both iOS and Android platforms.

This got me in touch with React.js, which I would use for the frontend. For the backend, although i would like to explore Node.js, my .Net Core skills are way ahead and so, this would be my first choice.

Now here comes the actual questions that i've been trying to figure out.

Scenario: Client communicates over HTTP with other clients. Server keeps conversation logs.

  1. What is the difference between a REST API and a Web Server? Is my REST API my "server"?

  2. How do you structure your SaaS project? Do you have a Visual Studio solution with the Client, Database, API and Server projects all together? How do you deploy all of that, particulary the frontend?

  3. Do you keep each of this projects on different docker instances?

Sorry if this seems way newbie. I guess that i've been through so much information that things are starting to become a bit blurry.

Feel free to drop me any questions!

Cheers!

on February 11, 2020
  1. 2
    1. A web server is a HTTP server. REST is a protocol that is based on HTTP and usually returns JSON or a similar machine-readable format. HTTP is also used for other content types, like HTML (the human-readable format).
    2. I use containers (frontend, backend and database all in their own container) with docker-compose for development and I deploy to Kubernetes (it takes some time to learn but it's worth it).
    3. Yes.
  2. 2

    I usually have the following setup:

    • docker compose to easily manage all docker instances and networking between them
    • separate docker container for the frontend (includes required node.js, sass, and everything else in order to "compile" js)
    • separate docker container for the backend (running API server)
    • separate docker container for the database

    All containers map local directories with the source code so that I can develop on the host machine using my editor of choice. Both frontend and backend container track changes in files (via mapped directories) and re-compile code.

    I do not deploy docker containers to production, instead all of the frontend is compiled to a single js file, all the styles into a single css and are pushed to the CDN. Backend code is deployed to a separate application server. Database is running on a separate server too.

  3. 2

    Hey Ricardo. My first question would be do you plan on server side rendering your frontend or happy to host the frontend separately to the backend? My preference is always for the latter unless you have rely very heavily on SEO.

  4. 1

    To answer 2. this is what I did for Colofon. I need to say, I work on Windows (for now) and I'm not big on docker. So:

    • My DB is SQLite in dev and PostGres in prod
    • My API is part of a .sln that also contains the admin website that I use to control things, a shared DAL and service layer (all .Net Core)
    • The front is Angular

    Deploy:
    I use Gitlab CI and I have a VM at OVH + simple host with FTP for the front.

    On my VM, I test and deploy a router made with Ocelot (very powerfull), the admin and the API.

    The front is built by Gitlab and sent to the host through FTP.

    Feel free to ask if you have more questions.

  5. 1

    This comment was deleted 7 years ago