Giter Club home page Giter Club logo

bharney / jsstarterdocker Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 3.0 2.35 MB

.Net Core 2.1 C# with React Starter Project that provides Identity Authentication and Authorization using JWT. Based on .NET Core JavaScriptServices Spa React + Redux using TypeScript. Additional support available for Docker and ARM Templating. Project uses Key Vault for secrets and EntityFrameworkCore to migrate Identity tables.

Home Page: https://jsstarter.azurewebsites.net

TypeScript 54.96% CSS 5.47% C# 28.80% JavaScript 6.17% PowerShell 1.94% Dockerfile 0.38% Shell 0.08% HTML 2.08% PLpgSQL 0.13%
dotnet-core reactjs javascript react csharp redux typescript ssr aspnet-core arm-templates docker docker-compose keyvault

jsstarterdocker's Introduction

StarterPack

This Starter template allows you to spin up a React/Redux and .Net Core application with SQL Server and .Net Core Identity Authentication/Authroization. The site takes advantage of Server-Side Rendering and Lazy Loading based on Routes. Authentication is built into the App with JWT and Authorize attributes on controllers.

Technology Stack

  • .NET Core/ C# 2.1
  • React 16.3/ JavaScript
  • TypeScript
  • Redux
  • Webpack 4
  • SCSS
  • Bootstrap 4
  • Font-Awesome 5
  • Server-Side Rendering(SSR)
  • Lazy Loading(React-Loadable)
  • Hot Module Reloading(HMR)
  • Docker
  • Docker-Compose
  • Azure Resourcee Manager(ARM) Template
  • Key Vault
  • JWT Bearer Token

Setup Dependencies/ Requirements

  • Docker

Switch out the values in appsettings.json with your own seed account.

{
 "Logging": {
   "IncludeScopes": false,
   "Debug": {
     "LogLevel": {
       "Default": "Warning"
     }
   }
 },
 "Console": {
   "LogLevel": {
     "Default": "Warning"
   }
 },
 "BlobService": {
   "StorageUrl": "https://jsstarter.blob.core.windows.net/"
 },
 "ConnectionStrings": {
   "LocalConnection": "Server=db;Database=master;User=sa;Password=[PASSWORD];"
 },
 "Token": {
   "Issuer": "https://jsstarter.azurewebsites.net",
   "Key": "[TOKEN_KEY]"
 },
 "SeedAccount": {
   "UserName": "[ADMIN_EMAIL]",
   "Password": "[PASSWORD]"
 }
}

Run Project with Docker

docker-compose -f ".\docker-compose.yml" -f ".\docker-compose.override.yml" build

This will build two docker containers. One for the web application, and another for the SQL server database. The database will be seeded with a starting Admin Account to login with.

Run Project

  • dotnet run

Set Environment in PowerShell

  • $Env:ASPNETCORE_ENVIRONMENT = "Development"
  • $Env:ASPNETCORE_ENVIRONMENT = "Production"

Road Map

I am working to split this template into repos the correspond to the ARM templating. That is one that spins up Azure Resources needed for Docker, and one that spins up more of a classic application without docker

jsstarterdocker's People

Contributors

bharney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jsstarterdocker's Issues

Add Unit Tests to Docker build

  • when build finishes, create an image and run automated tests
  • after tests pass, then build image and push to private docker repository

Registration Confirmation Email should not be a protected route and fix typo

As a new user, when trying to register a new account. After registration, I receive a registration email confirmation to ensure the email is valid. However there are two problems:

  • the link for registration has a typo which points to the wrong domain (i.e. sstarter/Account/RegistrationConfirmationEmail... but it should be jsstarter/Account/...)
  • When clicking on the confirmation email link, I am directed to the site but then redirected to login page. The alert says I need to login before continuing. However this prevents any users from registering.

Setup KeyVault

Setup key vault for secrets management

  • Connection Strings
  • Email Keys
  • Default user values

Seed Data

  • Setup Seed data for Admin Account to run the first time the project is setup. The code exists, but is commented out in Startup.cs

Profile Displays Broken Image if not profile image is uploaded

  • Profile tab should display form-stepper if the user has not filled out the form before (does not have Image or First Name or Last Name).
  • We should do this because the Profile displays broken image if no profile image is available. We should have a fallback profile icon.
  • Display error message if upload for image is not successful with meaningful error message.

Allow user to Avoid Setting up KeyVault

When setting up fresh, one of the dependencies is KeyVault for secrets.

  • Add commented out section for working locally which allows the user to start the site by simply running it with dotnet run

Update README to Include npm global installs and KeyVault

  • Add information about npm global installs for webpack webpack-cli node-sass
  • Add information about how to setup KeyVault in Azure. Or at least point to resources for microsoft.docs.
  • Add appsettings.json code snippet to avoid confusion about what secrets are getting pulled from KeyVault.

GDPR Compliant

  • Add button within Account tab to delete Account. On click it should ask for a confirmation, and then proceed to cascade delete the user all user data.
  • Add button to allow the user to export Account data into json file.

Add Settings page with Account and Profile tab features

  • Setup tabs on Account Page to include Account tab, and Profile tab. Use existing Bootstrap 4 nav components.
  • Account tab should have change password. Required fields are Old password, New password, Confirm new password.
  • Account tab should have change email. User should receive a email confirmation to both email addresses. Once both email links have been verified the user email will be updated.
  • Account tab should have Delete account.
  • Add file type validation to only allow jpg, jpeg, png, gif

Split into 2 Projects

StarterPack with Identity Authentication

  • Setup Authentication to include Profile
  • Setup Admin Side to Create Roles and Add Users to Roles
  • Setup Admin to View Registered users, and update their information and Roles.

Docker project

  • Builds SQL server instance in container
  • Runs EF migrations and gets DB status setup on build
  • Build StarterPack Project files and generate output from webpack
  • Change folder structure to be consistent with JavaScriptServices

Switch to Reach Router

  • Added and implemented routes using Reach Router
  • Additionally, need to setup Routes to be Nested as Components instead of the current flat structure which is similar to how v3 is setup for match. Need to switch to using components that all have a base root as a route.

After hearing Ryan Florence and btholt talk about reach router, it seems like a better way to go than v4. It should handle issues with SSR and in the future React Suspense.

Setup Cache

  • Add a IMemory Cache for database requests

Setup Profile

  • Setup Profile for displaying image
  • Multi-Form for setting up profile
  • Uploading to blob storage

Setup Docker

Setup docker for continuous integration and continuous deployment.

  • when commit occurs on master, have CI run docker command to build container and publish output.
  • After pushing, then deploy

NodeInvocationException: document is not defined on initial project startup. But fine after refreshing page (F5)

Force VS Build to wait for Webpack Completion before displaying page

  • When developing locally, the VS build is trying to display the site before the webpack build is completed. The webpack build unfortunately takes a few seconds longer than the VS Build and results in NodeInvocationException: document is not defined on page load.
    However if you wait until webpack build completes and refresh the page, everything loads fine. Super irritating.

Migrate to .NET Core 2.1 with additional CompatibilityFlag turned on

  • Upgrade Startup.c project to use CompatibilityVersion.Version_2_1
    services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

  • Resolve issues with Server Side Rendering with the new changes.

  • Adding the following for SSR
    services.AddNodeServices();
    services.AddSpaPrerenderer();

Setup Emailing

  • Setup SendGrid to email users about registration email confirmation, forgot password, reset password.

SSR Fails on first page load for authenticated pages

Expected:
When trying to hit an protected client side resource, while logged in/authenticated, the user should be able to login.
Actual:
The user is getting an error on client side, and is not directed to route. Blank/white page displays instead.

Setup CI/CD

  • Ability to check into master and trigger VSTS build process.
  • Add Resource Manager to VS solution
  • ARM Template to automate the resource manager process with a script
  • Trigger ARM to build or update the template after check-in to master
  • Run the build and create drop for deployment
  • Add build step to automatically run the Unit Test project after the build has completed
  • If Unit Tests pass and build is successful, then deploy the app service and swap.
  • Add step to Release process that runs entity framework migration

Docker SQL Server Persistance

If I am experimenting with user sessions would it be possible to set up persistent storage for the local SQL Server container via named volumes?

Add Third Party sign in (Google, Github, Twitter)

  • Add ability to sign in via Google
  • Add ability to sign in via Github
  • Add ability to sign in via Twitter
  • On sign in click with third party provider, user is prompted for user name and password if not already logged in with that provider.
  • After successful authentication, user should be required to view scope and accept or deny permissions.

Debug locally

This looks like just the kind of fleshed out example I have been looking for, but I'm having trouble getting up and running locally and hoping you might be able to give me a nudge in the right direction.

Did the following according to your instructions:

npm install webpack webpack-cli -g

.. followed by "dotnet restore" which appeared to work fine.

However, "dotnet build" is returning an error:

EXEC : error : Cannot find module 'D:\ReactStarterPack\StarterPack\node_modules\webpack\bin\webpack.js' [D:\ReactStarterPack\StarterPack\StarterKit.csproj]

I would have though webpack would be resolved by the global install?

Fix Config Values

  • Sync the appsettings.json with the values that are in _config["Key"]

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.