Skip to content

A single-page application (SPA) skeleton based on Mithril.js and Slim Framework trying to use good practices

License

Notifications You must be signed in to change notification settings

tbreuss/mithril-slim-skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPA Skeleton with Mithril.js and Slim Framework

This is a single-page application (SPA) skeleton based on Mithril.js and Slim Framework 4 trying to use good practices. The application itself offers a frontend and backend, that allows you to view and manage some specific CRM data.

Demo

https://mithril-slim-skeleton.tebe.ch/

Features

JS frontend

  • Single page application (SPA) using Mithril.js
  • Mitosis pattern for simple state management
  • Types without TypeScript using JSDoc
  • Frontend Tooling with vite.js
  • Minimal CSS with Pico.css
  • ESLint JavaScript Linter
  • Testing

PHP backend

  • REST API using Slim Framework 4
  • Autoloading (PSR-4)
  • Code styles (PSR-12)
  • Dependency injection container (PSR-11)
  • HTTP message interfaces (PSR-7)
  • HTTP Server Request Handlers and Middleware (PSR-15)
  • HTTP factories (PSR-17)
  • HTTP router and dispatcher (Slim)
  • Logging (PSR-3)
  • PHPDoc standard (PSR-5, PSR-19)
  • PHPStan (Level: max)
  • Single action controllers
  • Domain Driven Design (DDD) partially
  • JWT for (synchronous) authentication
  • Unit Tests
  • Integration Tests

Database

  • Database Migrations using Phinx
  • SQLite database (for the sake of simplicity)
  • Migration scripts
  • Seed scripts using Faker

Requirements

  • PHP >= 8.0
  • Composer >= 2.0
  • Node >= 17.0
  • NPM >= 8.0

Installation

git clone https://github.com/tbreuss/mithril-slim-skeleton
cd mithril-slim-skeleton
sh setup.sh

Development

Start development environment

sh start.sh

Or start backend and frontend manually, see README files in own repos.

Scripts

Frontend

Command Description
eslint:check eslint . --ext .js
eslint:fix eslint . --ext .js --fix
ts:check tsc --project jsconfig.json
ts:check:watch tsc --watch --project jsconfig.json

Backend

Command Description
cs:check Runs the cs:check script as defined in composer.json.
cs:fix Runs the cs:fix script as defined in composer.json.
lint:check Runs the lint:check script as defined in composer.json.
sniffer:check Runs the sniffer:check script as defined in composer.json.
sniffer:fix Runs the sniffer:fix script as defined in composer.json.
stan:check Runs the stan:check script as defined in composer.json.

Links

Toolset used

Helpful websites, articles, and blog posts

Contributing

Please create an issue before sending a pull reqest.

License

The MIT License (MIT). Please see License File for more information.