Giter Club home page Giter Club logo

vite-insee-starter's Introduction

Single Page Application starter

This is a suggested stack to build modern SPA.
It's hosted here : https://vite-insee-starter.demo-domain.ovh/

It's composed of:

  • Docker
  • Nginx
  • Vite
  • TypeScript
  • React
  • Tanstack Router - A better alternative to React Router.
  • πŸ“ react-dsfr - The React Toolkit for The French Design System (DSFR)
  • MUI - As a backup component library to fallback to if you don't find the component you need in the DSFR library.
  • πŸ“ vite-envs - A solution to avoid having to re-build the app when you change the environment variables.
  • πŸ“ tss-react - A CSS-in-JS solution.
  • πŸ“ i18nifty - A solution to to make your app available in multiple languages.
  • react-query - A solution to manage your API calls.
  • πŸ“ oidc-spa - A solution to integrate OpenID Connect in your app. (Keycloak)
  • πŸ“ tsafe - Type safety utilities.
  • πŸ“ ts-ci - GitHub Actions to manage the lifecycle of the project and publish automatically on Docker Hub.
  • Prettier - Code formatter.
  • Orval - A solution to generate API clients based on OpenAPI specs.

πŸ“: Made by us.

Running locally

git clone https://github.com/InseeFrLab/vite-insee-starter
cd vite-insee-starter
cp .env.sample .env.local
yarn
yarn dev

Deploying the APP

You can use the Docker Image published here: https://hub.docker.com/r/inseefrlab/vite-insee-starter
You have to set the environment variables:

VITE_API_URL=https://insee-todo-api.up.railway.app
VITE_OIDC_ISSUER=https://auth.code.gouv.fr/auth/realms/playground
VITE_OIDC_CLIENT_ID=vite-insee-starter

Automatic publishing on Docker Hub

The CI of this starter automatically publishes on dockerhub under <name of the github org>/<name of the repo>

For it to work you must have set the GitHub Actions secrets:

${{ secrets.DOCKERHUB_USERNAME }}
${{ secrets.DOCKERHUB_TOKEN }}

(It is configured in the option of the repo or the github org)

The TODO rest API

For demoing this stack we created a simple todo app REST API.
It's available here: https://github.com/InseeFrLab/todo-rest-api and is deployed here: https://insee-todo-api.up.railway.app/doc

The client used to consume this API is automatically generated by Orval.
You can refresh it for the currently published version of the API by running:

yarn generate-todos-api-client

Keycloak theme

When authenticating you will notice that the login pages are DSFR themed.
We're using the custom keycloak theme of the DSFR: keycloak-theme-dsfr πŸ“.
It has been created using react-dsfr and Keycloakify.

Build with this stack:

Onyxia

image

The French Interministeriel Base of Free Software

image

Why pushing tss-react over other styling solution?

You might think that tss-react isn't the more obvious choice and I'm just pushing it because we made it but here me out.
It has approximately 900 000 downloads per month and is used by establish solution like Jitsi and it integrates flawlessly with MUI. It's even mentioned in the official MUI documentation.

But more importantly. It's arguably the one of the most powerful styling solution. It enables to write styles as a function of the internal state of the component.
It let you express sophisticated styling logic in a way that is easy to read and maintain.

It's drawback is that, as it's a dynamic styling solution (as opposed to statically extracted ones like tailwind), it's doesn't have the same performance and is not compatible with Next.js Server Components. However at Insee we're building SPA and the performance hit is negligible (we're talking about a few milliseconds).

vite-insee-starter's People

Contributors

garronej avatar ddecrulle avatar

Stargazers

 avatar

Watchers

CΓ©dric Couralet avatar  avatar Romain Lesur avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.