No Description

Olivier Massot d3a3d218b3 minor fixes 6 months ago
api 6d331d67f1 add github header btn and fix api env file 6 months ago
app d3a3d218b3 minor fixes 6 months ago
docker b81eeef854 update default domain and readme 6 months ago
.env.skeleton a6fdbbb43b init 3 years ago
.gitignore a6fdbbb43b init 3 years ago
docker-compose.yml 09625b1ab0 switch to mysql, add db configuration and basic entities 9 months ago
readme.md d3a3d218b3 minor fixes 6 months ago

readme.md

Fullstack demo : Symfony + Nuxt + Caddy

This project is a full-stack web application demonstrating the integration of modern web technologies through a Docker Compose setup.

It serves as both a proof of concept and a starter template for developers looking to work with this particular technology stack.

The backend is built with Symfony 7 and API Platform 4. The frontend uses Nuxt.js 3 with Vuetify components and TypeScript. The entire application is served through Caddy web server, offering automatic HTTPS. Enjoy!

Install

Choose a domain's name for your project (project default: 'snc-demo.net'), then add those lines to your hosts file :

127.0.0.1 local.api.<domain>.fr
127.0.0.1 local.app.<domain>.fr

Run from the project directory :

docker-compose build

Copy the .env file and edit it if needed :

cp .env.skeleton .env

Edit the following files to update the directives with you domain name

  • docker/api/vhost.conf
  • docker/caddy/Caddyfile
  • api/.env
  • app/.env

Run

Run from the project directory :

docker-compose up

Install the API server :

docker exec -it snc_demo_api bash
composer install --with-all-dependencies
bin/console doctrine:database:create
bin/console doctrine:schema:update --force

Start the nuxt server:

docker exec -it snc_demo_app bash
yarn install
yarn dev

Warning: You will probably have to open a tab for both of the subdomains (local.api.<domain>.net and

     `local.api.<domain>.net`) in your browser to add a security exception for the self-signed SSL certificate.

Without it, the frontend's requests will be blocked as CORS errors.

Add Fixtures

docker exec -it snc_demo_db bash

mysql -u root -p'Hxb3aMXUPb3m%$Ai*' -D snc_demo -e "
    ALTER TABLE `snc_demo`.`author` AUTO_INCREMENT = 1;
    INSERT INTO `snc_demo`.`author` (`name`)
    VALUES 
        ('Artist 1'),
        ('Artist 2'),
        ('Artist 3');

    ALTER TABLE `snc_demo`.`song` AUTO_INCREMENT = 1;
    INSERT INTO `snc_demo`.`song` (`title`, `author_id`)
    VALUES
        ('Song A', 1),
        ('Song B', 1),
        ('Song C', 1),
        ('Song D', 2),
        ('Song E', 2),
        ('Song F', 3),
        ('Song G', 3);
"

Warning : If you plan to use this as a starter for your own project, don't forget to change the DB password !

Try it

At this point, the application should be served at https://local.app.snc-demo.fr/.

Accessing the OpenAPI Interface

The OpenAPI interface is available at:

https://local.api.snc-demo.net/api/docs

This interface provides documentation for all available API routes.