batuhan / og-saltana

Abandon iteration for Minipage
https://www.minipagehq.com
1 stars 0 forks source link

Saltana

Archived project.

We are not using this codebase, this was an early attempt at an MVP for Minipage (then Saltana)

This repository is the monorepo for every internal Saltana project. This includes development environment, docs, build tools, forks and more.

Services are deployed projects (web apps, api, workers) and Packages are shared code to be used in those services (or partner services). Currently no packages are published.

Repository is managed with yarn workspaces. Make sure you use Volta to manage Node versions across projects and yarn v2 (berry) for dependency management. Otherwise, side effects might include heavy crying, loss of sleep and productivity since Saltana relies on code that runs on wildly different platforms.

Environments

env base
production https://www.saltana.com
staging https://staging.saltana.com
development https://dev.saltana.com
local http://localhost

Cloud services

Projects

At a glance because the CTO lieks to write long:

name description routes/pkg name
core main api /api/v1/* (proxied by edge)
web server rendered web app /* (proxied by edge)
edge cloudflare worker for fast cache, proxy, auth and more /*, /api/v0/*
sdk SDK for interacting with core @saltana/sdk
fil cli & library files @saltana/fil
env shared config service @saltana/common

All services are deployed under a single domain as defined in Environments above.

core | service

Where the magic mostly happens. This is our main API. Internal Workflows, Webhooks, Transactions, Content and most everything is managed from there.

Forked from Stelace. Made for a Marketplace API SaaS (designed for multiple marketplaces with isolated databases), it covers our case perfectly. Stelace is licenses under GNU GPL 3.0

It uses a micro-service framework called cote to separate service calls and HTTP requests, which we'll separate to move the entire API to serverless because it's way easier to manage and scale. It also features a plugin architecture.

Dependencies

Note that included docker-compose files gets you running with all the dependencies without much work.

Deployed on DigitalOcean Apps. With the database at TimescaleDB Cloud for now because of licensing issues.

Served behind edge.

web | service

Next.js, mixed TypeScript and JavaScript, react-query, SSR, next-seo, next-auth

Deployed on Vercel. Served behind edge.

edge | service

CloudFlare Worker that authorizes, proxied and caches our services. It runs on every CloudFlare location so provides instant responses to our visitors. Payment Intents for Stripe for example are created at the edge so the payments are instant.

Both server side produced HTML from the webapplication and the subsequent API requests to core are cached if they are not authorized (so most requests never hit on our serves).

Uses CloudFlare KV to store the cache.

It'll also allow us to build custom domains on top of it in the future.

SDK for embeds are served from here. The external checkout UI will also be rendered here directly for a faster experience.

sdk | package

A browser and NodeJS library for interacting with core.

fil | package

Internal command line application for a better development experience. It also includes a wrapper for the SDK for internal modules.

env | package

Shared configs to be used in every service.

How to run