/angular-spring-starter

Full stack starter kit featuring Angular 7, Spring boot and stateless JWT authentication.

Primary LanguageTypeScriptMIT LicenseMIT

npm StackShare Build Status Maintenance Status License MIT

Spring Boot and Angular 2

Angular Spring Boot JWT Starter

An Angular full stack starter kit featuring Angular, Router, Forms, Http, Services, Spring boot, JSON Web Token

If you're looking to use Angular as your frontend implementation, please check out springboot-jwt-starter A Spring Boot token-based security starter kit featuring AngularJS and Spring Boot (JSON Web Token)

Springboot JWT Starter

Quick start

Make sure you have Maven and Java 11 or greater Make sure you also have NPM 6.12.0, Node 12.13.0 and angular-cli@9.1.3 globally installed

# clone our repo
# --depth 1 removes all but one .git commit history
git clone --depth 1 https://github.com/bfwg/angular-spring-starter.git

# change directory to the repo's frontend folder
cd angular-spring-starter/frontend

# install the frontend dependencies with npm
# npm install @angular/cli@9.1.3 -g
npm install

# start the frontend app
npm start

# change directory to the repo's backend folder
cd ../server

# install the server dependencies with mvn
mvn install

# start the backend server
mvn spring-boot:run

# the fronend angular app will be running on port 4200
# the spring-boot server will be running on port 8080

There are two user accounts present to demonstrate the different levels of access to the endpoints in the API and the different authorization exceptions:

Admin - admin:123
User - user:123

For more detailed configuration/documentation, please check out the frontend and server folder.

Deployment

# clone our repo
# --depth 1 removes all but one .git commit history
git clone --depth 1 https://github.com/bfwg/angular-spring-starter.git

# change directory to the repo's frontend folder
cd angular-spring-starter/frontend

# install the frontend dependencies with npm
# npm install @angular/cli@9.1.3 -g
npm install

# build frontend project to /server/src/main/resources/static folder
ng build

# change directory to the repo's backend folder
cd ../server

# install the server dependencies with mvn
mvn install

# start the server
mvn spring-boot:run

# the app will be running on port 8080

For more deployment related info checkout here: DEPLOYMENT DOC

JSON Web Token

JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties. for more info, check out https://jwt.io/

Token authentication is a more modern approach and is designed solve problems session IDs stored server-side can’t. Using tokens in place of session IDs can lower your server load, streamline permission management, and provide better tools for supporting a distributed or cloud-based infrastructure.

-- Stormpath

Importing the Project in IntelliJ IDEA

  1. Click "Import Project" on the launch screen
  2. Select the projects root folder, then select "Import project from external model" and choose "Maven"
  3. Tick the checkboxes "Import Maven projects automatically" and "Import projects recursively"
  4. Continue the dialog until the IDE opens the project
  5. Open the "Project Structure" dialog
  6. On the left side, choose "Modules" and click the "Add" button
  7. Choose "Import Module", then select the frontend folder
  8. Choose "Create module from existing sources" and continue in the dialog until the module is added.
  9. You should now see both (frontend and backend) modules in the Project view

Contributing

I'll accept pretty much everything so feel free to open a Pull-Request

This project is inspired by


License

MIT