GithubHelp home page GithubHelp logo

mpiorowski / spring-react-auth Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 4.12 MB

JWT authorization app with spring-boot, react and postgresql

Java 36.82% Shell 0.28% JavaScript 55.20% HTML 1.88% CSS 3.86% Dockerfile 1.97%
applications

spring-react-auth's Introduction

JWT authorization app with spring-boot, react and postgresql

Sample application with separate frontend and backend, connected to postgresql database. Authorization via jwt tokens. Offers a basic ui to manage users and products data.

Frontend -> react + antd + babel
Backend -> spring boot + flyway + mybatis + postgresql

Initial access

http://localhost:3000 (dev) or http://localhost (prod)
username: user
password: pass

Deployment

Prerequisites and Dependencies

Prerequisites: node, npm, java, maven, docker, docker-compose

Dependencies (not needed for production installation using docker):

mvn -f ./api clean dependency:resolve; \
npm --prefix ./ui install ./ui

Development deployment

database

PostgreSQL (configuration in application.yml):
port: 5432
scheme: auth
user: admin
pass: admin

or You can use docker-compose to setup simple database container

docker-compose -f ./docker/docker-compose.database.yml up -d --build

frontend and backend

Run two separate shell windows for frontend and backend. (Or just use your favorite IDE :) )

mvn -f ./api spring-boot:run
npm --prefix ./ui start

Access via http://localhost:3000

Production deployment using docker-compose

This one line creates a production ready downsized containers.
Only docker and docker-compose are needed as prerequisites.
After the automatic startup, which may take a while, the application is ready to work.

docker-compose -f ./docker/docker-compose.prod.yml up -d --build

Access via http://localhost

Production manual deployment

Database need to be manually setup up as in application.yml config file.
Server proxy need to be set for frontend url to backed port:
localhost/api/ - localhost:9000/api/

Run two separate shell windows for frontend and backend.

mvn -f ./api clean package; \ 
java -jar ./api/target/api-0.0.1-SNAPSHOT.jar
npm --prefix ./ui run build; \
npm install -g serve; \
serve -s ./ui/build

Access via http://localhost

Swagger

For the development build there is an active swagger component for api documentation.
Access via ui link or by entering http://localhost:9000/swagger-ui.html.
You need to authorized it by clicking "Authorize" button and then passing your jwt token as: "Bearer your_jwt_token".

spring-react-auth's People

Contributors

lsnmateuszp avatar mpiorowski avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.