Skip to content

Commit

Permalink
Add API-Platform web platform example (#1)
Browse files Browse the repository at this point in the history
* Add symfony/uid

* Clean up .idea/ for api-platform

* Move Kernel to Shared/

* Automatically configure src/Module/{ApiResource,Entity} folders

* Update API title

* Setup modular folder structure

* Add OrmProcessor

* Add unique AbstractUuidEntity uuid property

* Add simple user registration via API

* Refactor UserRegisterProcessor, add UserProvider

* Add GetCollection for UserModel

* Add makefile and test namespaces check script

* Refactor UserProvider, add filtering and pagination

* Add UserRegisterProcessorTest

* Add LexikJWTAuthenticationBundle

* Prefix api routes with /api/

* Configure security

* Test authentication, add UUID to JWT payload

* Add Exam entity

* Add StethoMeApiClient, save examination date

* Scaffold basic front end, registration UI

* Improve performance on Windows/Mac

* Add login support to admin panel

api-platform/admin#503 (comment)

* Fix ExamModel examinedAt name

* Add NextAuth authentication to /app

* Add custom layout for /app

* Store client API token in session

* Add exams pages

* Add navbar layout

* Redirect NextAuth routes to PWA container

They overlap with our /api/auth and customization does not seem to work so this is a bit of a workaround.

* Fetch client token in exam details view

* Add Media-API token endpoint

* Implement fetching Media-API token from external API

* Add mediaUrl to Media-API token output

* Finish implementation of exam screen

* Code format

* Fix PWA dockerfile build

* Fix Caddy build

https://dunglas.dev/2023/08/6x-faster-docker-builds-for-symfony-and-api-platform-projects/
  • Loading branch information
veteran29 authored Aug 8, 2023
1 parent cd39f56 commit ac6fc2f
Show file tree
Hide file tree
Showing 112 changed files with 3,474 additions and 333 deletions.
83 changes: 83 additions & 0 deletions api-platform/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
/.env
/helm/api-platform/charts/*
!/helm/api-platform/charts/.gitignore

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/remote-mappings.xml
.idea/modules.xml
.idea/**/api-platform.iml
.idea/**/php.xml
.idea/**/discord.xml
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
11 changes: 0 additions & 11 deletions api-platform/.idea/api-platform.iml

This file was deleted.

15 changes: 15 additions & 0 deletions api-platform/.idea/codeception.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions api-platform/.idea/discord.xml

This file was deleted.

1 change: 1 addition & 0 deletions api-platform/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions api-platform/.idea/modules.xml

This file was deleted.

128 changes: 0 additions & 128 deletions api-platform/.idea/php.xml

This file was deleted.

13 changes: 13 additions & 0 deletions api-platform/.idea/phpspec.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions api-platform/.idea/phpunit.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions api-platform/.idea/symfony2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api-platform/api/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ vendor/
.env.local
.env.local.php
.env.test
config/jwt/
13 changes: 12 additions & 1 deletion api-platform/api/.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
TRUSTED_HOSTS=^(localhost|caddy)$

# StethoMe
STETHOME_API_URL=https://dev.middleware.stethome.com/
STETHOME_API_MEDIA_URL=https://dev.media-api.stethome.com/
STETHOME_API_TOKEN=

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=!ChangeMe!
APP_SECRET=!ChangeMeStethoMe!
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
Expand All @@ -45,3 +50,9 @@ MERCURE_PUBLIC_URL=https://localhost/.well-known/mercure
# The secret used to sign the JWTs
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
###< symfony/mercure-bundle ###

###> lexik/jwt-authentication-bundle ###
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=1a29b9564a881befbadb4c1881c941f302cacdec70ebbc24a8607f804c018cd2
###< lexik/jwt-authentication-bundle ###
4 changes: 4 additions & 0 deletions api-platform/api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###
15 changes: 5 additions & 10 deletions api-platform/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,14 @@ RUN set -eux; \

RUN rm -f .env.local.php

# Build Caddy with the Mercure and Vulcain modules
# Temporary fix for https://github.com/dunglas/mercure/issues/770
FROM caddy:2.7-builder-alpine AS app_caddy_builder

RUN xcaddy build v2.6.4 \
--with github.com/dunglas/mercure/caddy \
--with github.com/dunglas/vulcain/caddy

# Caddy image
FROM caddy:2-alpine AS app_caddy

WORKDIR /srv/app
ARG TARGETARCH

COPY --from=app_caddy_builder --link /usr/bin/caddy /usr/bin/caddy
# Download Caddy compiled with the Mercure and Vulcain modules
ADD --chmod=500 "https://caddyserver.com/api/download?os=linux&arch=$TARGETARCH&p=github.com/dunglas/mercure/caddy&p=github.com/dunglas/vulcain/caddy" /usr/bin/caddy

WORKDIR /srv/app
COPY --from=app_php --link /srv/app/public public/
COPY --link docker/caddy/Caddyfile /etc/caddy/Caddyfile
Loading

0 comments on commit ac6fc2f

Please sign in to comment.