You've been building an awesome Angular app locally, you even started using Firebase for hosting, but now you want to have a real server and SQL database. What do you do? What's the last amount of work you can do to start shipping a services layer?
Here's one process.
In this case we'll just add an API, and keep using Firebase (or any JamStack host) for our FrontEnd.

Add server folder to your project

Put your APIs, SQL commands, ETL, processing, etc here.
Let's create a super simple server using NestJS
import * as express from 'express';
// import { log } from './log';
// import { API } from './api';
import { registerRoutes } from './routes';
import * as compression from 'compression';

const connection = API.factory();

const app: express.Express = express();
const mode = app.get('env');

connection.then((api) => {
    // console.log('DB connection is ready.');

    if (mode === 'process') {
        setTimeout(() => api.process(), 1000);
    } else if (mode === 'development') {
        setInterval(() => api.process(false),15000);
    if(mode !== 'process') {
        const port = mode == 'production' ? 11670 : mode == 'staging' ? 11671 : 11671;
        // const credentials = require("./lib/credentials").credentials[mode];

        // Trust the proxy
        app.set('trust proxy', 'loopback, linklocal, uniquelocal');

        app.use(function (req, res, next) {
            res.header('Access-Control-Allow-Origin', '*');
            res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
            res.header('Access-Control-Allow-Methods', 'OPTIONS, GET, POST, DELETE');
            if ('OPTIONS' == req.method) {
            } else {
                log(`${req.ip} ${req.method} ${req.url}`);



        // Send SPA via public
        app.use((req, res) => res.sendFile(`${__dirname}/dist/index.html`));
        app.listen(port, '', function () {
            console.log(`BundleSizeServer Listening on ${port} in ${mode} mode.`);

Configure a server

I'm going to use Apache with a reverse proxy to a local ts-node process.
Here's my virtual host setup. Just pick a high port, any port (11670 in this case).
<VirtualHost *:80>

    ProxyPreserveHost On
    ProxyVia Full
    <Proxy *>
        Options -Indexes +FollowSymLinks

    <Location "/">

    ErrorLog /var/www/logs/
    CustomLog /var/www/logs/ combined


Use SQLite (no setup) or CloudSQL (more future proof)