- TypeScript 62.6%
- Vue 28.7%
- MDX 7.4%
- CSS 0.7%
- JavaScript 0.5%
- Other 0.1%
| .vscode | ||
| functions | ||
| shared | ||
| spa | ||
| .firebaserc | ||
| .gitignore | ||
| firebase.json | ||
| README.md | ||
SaaS Chariot
SaaS Chariot is an opinionated framework to rapidly develop SaaS products. This repository acts as a template for a SaaS Chariot project.
Initiating a Project
How to Fork
To create a new project based on this framework, do not use the 'fork' feature of GitHub. Instead, follow these steps:
-
On GitHub, create a new empty repository, let's call this the project repo.
-
git clonethe project repo locally andcdinto it. -
Add this, the
mainbranch of the framework repo, as an upstream remote to the project repo clone, let's name this remoteframework.:git remote add framework https://github.com/ParkourOps/saas-chariot -
Create a local branch on the project repo clone called
frameworkwhich will reflect themainbranch of the framework repository.git fetch framework main git checkout -b framework --track framework/main -
Create the
mainbranch on the project repo.git checkout -b main git push -u origin main -
Install the Node dependencies and get developing!
npm install
Features
Framework
-
TypeScript is used to ensure consistency in the structure of data and the interfaces to runtime components that use data.
-
Vue 3 is used as the overall framework to implement the Single Page Application (SPA).
-
Daisy UI is used as the primary styling framework; it provides a level of abstraction (and therefore consistency) over Tailwind CSS.
-
SCSS is used to create and manage custom styling via dynamic stylesheets.
Analytics and Logging
- MixPanel is used to track user actions.
- Hotjar is used to capture user behaviour metrics.
Authentication
- Firebase Authentication is used for federated sign in.
Data Storage
- Firestore Database is used to store data in document collections.
File Storage
- Firebase Storage is used to store files. It is a wrapper over Google Cloud Storage, a managed cloud object storage service.
Customer Feedback
- Tawk.to is used to capture user feedback and have a live chat with visitors.
Subscription and Billing
- Firebase Functions are used to automatically create a user profile in the database.
User Alerts
Saas Chariot uses a number of ways to notify users about an event:
- In-App Notifications:
- Popup Alerts
- Toast Notifications
Note: Currently, In-App Notifications only originate from the frontend.
- Email Notifications: *
Folder Structure
Application source code is stored in the src folder.
Structure of the src folder is inspired by this guide:
-
assetscontains anything that isn't code:imagesiconsfontsstylesis where SCSS stylesheets are stored. Make sure to@importall global stylesheets inmain.scss.
-
componentscontains SFCs (<component-name>.vue, where<component-name>is in PascalCase") used across the project, organised into the following subfolders:uito store UI components like cards, modals, and buttons.formto store components specifically used in forms such as checkboxes, inputs, date pickers, etc.layoutsto store reusable layout components such as sidebars, navigation bars, containers, etc.modalsto store modals implemented using<Modal></Modal>as root component, shown using the ModalStack plugin's$showModal(<component>, <component props as obj>)function.
-
configscontains interfaces to application configurations; the configurations themselves are passed into Vite as environment variables. -
datais used to store data assets such as JSON files. -
stateis used to store global state in the form of Pinia stores. -
featurescontains one folder for each feature in the application. Each feature folder may contain:- (any folders listed here, apart from global folders such as
features,pluginsandstate.)
- (any folders listed here, apart from global folders such as
-
librariescontains facades/abstractions for the various different libraries used in the project. Using facades means libraries don't have to be directly imported into rest of application codebase multiple times, making it easier to update/replace library or customise it for own use. -
pluginscontains Vue plugins; Vue plugins are always applied globally. -
pagescontains SFCs, each SFC represents a unique page (<page-name>.vue) where<page-name>is in "PascalCase".- If the page SFC must use other SFCs that will only be used on the page, create a folder called
<page-name>, store the page SFC as<page-name>.vueand others as<component-name>.vue. - It may be helpful to organise pages into arbitrary folders, in which case the name of such a folder must abide by the generic "kebab-case" used throughout the project (with exception of Vue components including pages).
- If the page SFC must use other SFCs that will only be used on the page, create a folder called
-
servicescontains code used to interface with external APIs (instead of litering rest of application codebase with API interaction code). -
utilitiescontains files that export simple pure functions such as formatters that do not cause side effects.
Recommended IDE Setup
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
Type Support for .vue Imports in TS
TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensionsfrom VSCode's command palette - Find
TypeScript and JavaScript Language Features, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Windowfrom the command palette.
Customize configuration
See Vite Configuration Reference.
Project Setup
npm install
Compile and Hot-Reload for Development
npm run dev
Type-Check, Compile and Minify for Production
npm run build
Run Unit Tests with Vitest
npm run test:unit
Run End-to-End Tests with Playwright
# Install browsers for the first run
npx playwright install
# When testing on CI, must build the project first
npm run build
# Runs the end-to-end tests
npm run test:e2e
# Runs the tests only on Chromium
npm run test:e2e -- --project=chromium
# Runs the tests of a specific file
npm run test:e2e -- tests/example.spec.ts
# Runs the tests in debug mode
npm run test:e2e -- --debug
Lint with ESLint
npm run lint
Things To Do
- Move
pluginstoframework_features - Auto-import all plugin features
- Update docs