Skip to content

Commit

Permalink
feat: add advanced features (#135)
Browse files Browse the repository at this point in the history
* Setup tools for local development

* Remove unused config

* feat(services): add redis as php extensions

* feat(docker-compose): Use env files from folders instead of root env file

* feat(services): implement container role

* feat(api): update default env

* feat(api): update dev command

* feat(api): implement snowflake ids and roles/permissions

* feat(api): guard pulse

* feat(api): gate telescope

* feat(api): disable telescope on default

* feat(api): update env to default options

* feat(api): implement is admin flag and migrate permission to this
because we only use this for internal tools like telescope and pulse we don't need to expose this flag

* feat(api): implement spatie permission teams as organizations
because this is in a feature branch we do not create a new migration and ignore the breaking change against this feature branch

* feat(vscode): add new extensions for development

* feat(docs): move dev docker compose docs to develop

* fix(chore): remove old zip version of project

* feat(vscode): add laravel artisan extension

* feat(api): add is default and is owner to roles table

* feat(api): remove roles and permission seeder

* feat(api): implement permissions enum

* feat(api): add first version of organization classes

* feat(api): migrate route function to app controller

* feat(api): implement own models for roles and permissions

* fix(api): add missing table to migration

* feat(api): implement roles for organizations

* feat(api): add a first basic debug route for testing

* docs(api): add docs to disable organization feature

* feat(api): disable fortify views

* feat(apps): first auth version with basic registration and csrf token support

* feat(apps): implement basic api call logic

* feat(apps): disable direct register call

* feat(apps): set semi to true

* feat(apps): refactor api logic

* feat(api): lint code

* style: run lint and format

* feat(apps): add dev components and add basic layout

* feat(api): add Laravel Auditing

* feat(api): add support for multiple languages

* fix(apps): ssr error on watch

* feat(apps): refactor api logic

* feat(apps): refactor api and basic register implementation

* fix(docker): fix wrong user

* feat(api): setup basic password rules

* feat(apps): refactor api logic to better support ssr

* feat(apps): refactor api code to make it cleaner

* fix(blog): use correct app name

* feat(apps): improve form validation ux on errors

* feat(api): implement health service

* feat(api): move health to own database

* chore: add iconify extension

* feat(apps): refactor auth layouts and implement logout

* fix(api): remove unneeded provider registration

* feat(apps): improve logout and prepare resend email verification

* featt(api): basic overwrite of emails for fortify

* feat(apps): implement email resend of email verification

* feat(apps): implement email verification

* feat(api): change default session cookie

* fix(apps): alert container shows margin even if slot is empty

* feat(api): update dependencies

* feat(apps): update dependencies

* feat(api): prohibit destructive commands

* feat(apps): improve submit handling

* feat(apps): improve form ux/ui

* feat(apps): improve form ui/ux

* feat(apps): implement password forgot

* featt(api): publish notification view

* feat(api): allow pulse view on local

* feat(apps): migrate auth pages to base package and put them behind a feature flag

* feat(apps): improve code

* feat(apps): remove unused code

* feat(apps): implement password reset

* feat(api): add app urls

* feat(api): implement laravel horizion

* fix(apps): remove dev comment

* feat(app): start implementation of dashboard

* feat(apps): implement remeber me logic

* fix(apps): checkbox and toggle style

* feat(scripts): update naming

* feat(apps): placeholder logic for a basic dashboard

* fix(api): add missing drop table

* feat(api): add first_name and last_name

* feat(api): add user organization

* feat(api): improve organizations me logic by migration endpoint to me endpoint

* fix(apps): toggle track style

* feat(apps): add exmple code

* feat(apps): improve dashboard ui

* fix(app): type error on search groups

* feat(apps): improve dashboard setup logic (better use of ssr and csr)

* feat(apps): migrate texts to local file

* feat(apps): extend default settings pages

* feat(apps): improve sidebar

* feat(apps): improve settings

* feat(apps): implement account update and password confirm

* chore: update all dependencies

* chore: lint code

* chore: format code

* feat(github): add php extensions

* feat(github): add php extensions

* fix(apps): adjust placeholder test to pass

* fix(services): add missing php extension
  • Loading branch information
TitusKirch committed Jun 9, 2024
1 parent 2cb3eff commit f70084a
Show file tree
Hide file tree
Showing 204 changed files with 17,344 additions and 2,879 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
APP_NUXT_UI_PRO_LICENSE="<your-license-key>"
APP_FORMKIT_PRO_KEY="<your-formkit-key>"
# Docker
COMPOSE_PROJECT_NAME="saas-template"
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ module.exports = {
parserOptions: {
project: true,
},
}
};
4 changes: 4 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ jobs:
with:
working_dir: "services/api"
php_version: '8.3'
php_extensions: bcmath pcntl

- name: Cache composer dependencies
uses: actions/cache@v4
Expand Down Expand Up @@ -180,6 +181,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: bcmath, pcntl

- name: Install node dependencies
run: pnpm install
Expand Down Expand Up @@ -265,6 +267,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: bcmath, pcntl

- name: Restore composer dependencies cache for service "api"
if: needs.files-changed.outputs.service_api == 'true'
Expand Down Expand Up @@ -335,6 +338,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: bcmath, pcntl

- name: Restore composer dependencies cache for service "api"
if: needs.files-changed.outputs.service_api == 'true'
Expand Down
6 changes: 3 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const config = {
// tailwindConfig: './packages/ui/tailwind.config.ts',
endOfLine: 'lf',
printWidth: 100,
semi: false,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
vueIndentScriptAndStyle: true,
}
};

module.exports = config
module.exports = config;
8 changes: 6 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"recommendations": [
"antfu.iconify",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"vue.volar",
"jacano.vscode-pnpm",
"ms-azuretools.vscode-docker",
"open-southeners.laravel-pint",
"richie5um2.vscode-sort-json",
"open-southeners.laravel-pint"
"ryannaddy.laravel-artisan",
"vue.volar"
]
}
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The saas-template is a template for building SaaS applications. It combines the capabilities of Laravel and Nuxt in a unified repository and accelerates the development of web applications. Seamlessly integrates the back-end reliability of Laravel with the front-end agility of Nuxt. Ideal for rapid prototyping and deployment.

## Features
## General

To manage the repository, it uses the pnpm package manager and turborepo.

Expand Down Expand Up @@ -121,6 +121,22 @@ To develop all apps and packages, run the following command:
pnpm dev
```

### dev.docker-compose.yml

To run all needed services locally, you can use the `dev.docker-compose.yml` file. You can run the following command to start the services:

```Shell
docker-compose -f dev.docker-compose.yml up
```

Below is a list of services you can access via browser.

| Service | URL | Description |
| --- | --- | --- |
| adminer | [http://localhost:8080](http://localhost:8080) | Database management tool. |
| redis-commander | [http://localhost:8081](http://localhost:8081) | Redis management tool. |
| mailpit | [http://localhost:8085](http://localhost:8085) | A simple SMTP server for development. |

## Linting and formatting

To lint and format all apps and packages, run the following command:
Expand Down Expand Up @@ -194,3 +210,29 @@ After that you can copy the generated icons to the `@tituskirch/font-awesome-pro
```Shell
pnpm copy
```

After that you can remove the line `icons: ['fa6-solid'],` from `packages/app-base/nuxt.config.ts` and uncomment the lines below it. You can also uninstall the package `@iconify-json/fa6-solid` from `@tituskirch/app-base`. After that you can mass replace the `fa6-solid` with `fal` in the code.

## Features

### Localization

To add a new language to the backend you can run the following command (all available languages can be found [here](https://laravel-lang.com/available-locales-list.html)):

```Shell
cd services/api/
php artisan lang:add {LANGUAGE_CODE}
cd ../..
```

To update the translations you can run the following command:

```Shell
cd services/api/
php artisan lang:update
cd ../..
```

### Organization

To disable the organization feature, you can set `teams` to `false` inside of the `services/api/config/permission.php` file. You also want to remove the migrations with organization in the name and the migration `services/api/database/migrations/2024_05_15_115605_add_is_default_and_is_owner_to_roles_table.php`. After that you should be able to user this template with the remaining Organization features. If you want to remove the organization feature completely, you can search the code for `Organization` and remove the code/files or adjust the code to your needs.
106 changes: 106 additions & 0 deletions app.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
version: '3.9'

secrets:
NUXT_UI_PRO_LICENSE:
environment: APP_NUXT_UI_PRO_LICENSE
FORMKIT_PRO_KEY:
environment: APP_FORMKIT_PRO_KEY

networks:
app_network:
driver: bridge

services:
blog:
container_name: blog
build:
context: .
dockerfile: ./apps/Dockerfile
args:
- APP_NAME=@tituskirch/blog
- APP_PATH=apps/blog
secrets:
- NUXT_UI_PRO_LICENSE
- FORMKIT_PRO_KEY
env_file:
- ./apps/blog/.env
restart: always
ports:
- 3001:3000
networks:
- app_network
web:
container_name: web
build:
context: .
dockerfile: ./apps/Dockerfile
args:
- APP_NAME=@tituskirch/web
- APP_PATH=apps/web
secrets:
- NUXT_UI_PRO_LICENSE
- FORMKIT_PRO_KEY
env_file:
- ./apps/web/.env
restart: always
ports:
- 3000:3000
networks:
- app_network
api-app:
container_name: api-app
build:
context: .
dockerfile: ./services/Dockerfile
args:
- SERVICE_NAME=@tituskirch/api
- SERVICE_PATH=services/api
env_file:
- ./services/api/.env
environment:
CONTAINER_ROLE: app
PULSE_SERVER_NAME: api-app
ports:
- '8000:8000'

api-scheduler:
container_name: api-scheduler
build:
context: .
dockerfile: ./services/Dockerfile
args:
- SERVICE_NAME=@tituskirch/api
- SERVICE_PATH=services/api
env_file:
- ./services/api/.env
environment:
CONTAINER_ROLE: scheduler
PULSE_SERVER_NAME: api-scheduler

api-queue:
container_name: api-queue
build:
context: .
dockerfile: ./services/Dockerfile
args:
- SERVICE_NAME=@tituskirch/api
- SERVICE_PATH=services/api
env_file:
- ./services/api/.env
environment:
CONTAINER_ROLE: queue
PULSE_SERVER_NAME: api-queue

api-pulse-worker:
container_name: api-pulse-worker
build:
context: .
dockerfile: ./services/Dockerfile
args:
- SERVICE_NAME=@tituskirch/api
- SERVICE_PATH=services/api
env_file:
- ./services/api/.env
environment:
CONTAINER_ROLE: pulse-worker
PULSE_SERVER_NAME: api-pulse-worker
3 changes: 2 additions & 1 deletion apps/blog/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
NUXT_UI_PRO_LICENSE="<your-nuxt-ui-license>"
FORMKIT_PRO_KEY="<your-formkit-key>"
FORMKIT_PRO_KEY="<your-formkit-key>"
API_URL="http://localhost:8000"
4 changes: 2 additions & 2 deletions apps/blog/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import withNuxt from './.nuxt/eslint.config.mjs'
import withNuxt from './.nuxt/eslint.config.mjs';

export default withNuxt()
export default withNuxt();
4 changes: 2 additions & 2 deletions apps/blog/histoire.config.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import histoireConfig from '../../packages/app-base/histoire.config'
export default histoireConfig
import histoireConfig from '../../packages/app-base/histoire.config';
export default histoireConfig;
4 changes: 2 additions & 2 deletions apps/blog/i18n.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { baseConfig } from '@tituskirch/app-base/i18n.config'
import { baseConfig } from '@tituskirch/app-base/i18n.config';

export default defineI18nConfig(() => baseConfig)
export default defineI18nConfig(() => baseConfig);
7 changes: 5 additions & 2 deletions apps/blog/locales/de.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"app": {
"bar": "DE-foo"
"page": {
"index": {
"description": "Willkommen auf der Startseite",
"title": "Startseite"
}
}
}
8 changes: 7 additions & 1 deletion apps/blog/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"app": {
"bar": "EN-foo"
"name": "blog saas-template"
},
"page": {
"index": {
"description": "Welcome to the home page",
"title": "Home"
}
}
}
2 changes: 1 addition & 1 deletion apps/blog/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export default defineNuxtConfig({
{ code: 'en-GB', iso: 'en-GB', files: ['en.json'] },
],
},
})
});
3 changes: 2 additions & 1 deletion apps/web/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
NUXT_UI_PRO_LICENSE="<your-nuxt-ui-license>"
FORMKIT_PRO_KEY="<your-formkit-key>"
FORMKIT_PRO_KEY="<your-formkit-key>"
API_URL="http://localhost:8000"
4 changes: 2 additions & 2 deletions apps/web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import withNuxt from './.nuxt/eslint.config.mjs'
import withNuxt from './.nuxt/eslint.config.mjs';

export default withNuxt()
export default withNuxt();
4 changes: 2 additions & 2 deletions apps/web/histoire.config.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import histoireConfig from '../../packages/app-base/histoire.config'
export default histoireConfig
import histoireConfig from '../../packages/app-base/histoire.config';
export default histoireConfig;
4 changes: 2 additions & 2 deletions apps/web/i18n.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { baseConfig } from '@tituskirch/app-base/i18n.config'
import { baseConfig } from '@tituskirch/app-base/i18n.config';

export default defineI18nConfig(() => baseConfig)
export default defineI18nConfig(() => baseConfig);
7 changes: 5 additions & 2 deletions apps/web/locales/de.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"app": {
"bar": "DE-foo"
"page": {
"index": {
"description": "Willkommen auf der Startseite",
"title": "Startseite"
}
}
}
52 changes: 51 additions & 1 deletion apps/web/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
{
"app": {
"bar": "EN-foo"
"name": "web saas-template"
},
"page": {
"index": {
"description": "Welcome to the home page.",
"title": "Home"
},
"settings": {
"description": "Here you can change your settings.",
"account": {
"notification": {
"success": {
"description": "Your account has been updated successfully."
}
},
"section": {
"name": {
"description": "Will appear on your profile, actions you take, communications and more.",
"title": "Name"
},
"email": {
"description": "User to sign in, notifications and product updates."
},
"password": {
"description": "If you don't want to change your password, leave these fields empty."
}
},
"title": "Account"
},
"index": {
"section": {
"layout": {
"description": "Change the layout of the app.",
"title": "Layout"
},
"locale": {
"description": "Change the language of the app.",
"title": "Locale"
},
"theme": {
"description": "Customize the look and feel of the app.",
"title": "Theme"
}
},
"title": "General"
},
"notifications": {
"title": "Notifications"
},
"title": "Settings"
}
}
}
Loading

0 comments on commit f70084a

Please sign in to comment.