Git Product home page Git Product logo

andculturecode.dotnetreact.boilerplate's Introduction

AndcultureCode.DotnetReact.Boilerplate

build statuscodecov All Contributors

Code name: Gravity Boots (GB)


Getting Started

Technologies

  • Dotnet Core 6.0
  • Node 8.16
  • NPM 6
  • React 16.13
  • SQL Server 2017+
  • TypeScript 3.8

Development Setup

1. Databases

SqlServer 2017 (Pending approval: could be PostgreSQL)
  1. Install Microsoft SQL Server 2017

  2. Create the following database

  3. Configure user.

    • Get credentials from the appsettings.json file listed above.
    • Right click on Security, then select New > Login
      • Add login name
      • Select SQL Server authentication
        • Add password
        • Deselect Enforce password policy and Enforce password expiration
    • Select Server Roles from Select a Page
      • Local development: Select all
    • Select User Mapping from Select a Page
      • For both the development and test databases:
        • Local development: Select all role memberships

2. Backend: Dotnet Core CSharp

Install Dotnet Core 3.1 SDK & Runtime

3. Frontend: React TypeScript

Install NodeJS 8.16 / NPM 6

4. CLI

There is a central and-cli used to manage builds, tests, deployments, etc... for the various aspects of the project.

Install the and-cli tooling found at AndcultureCode.Cli

Below are a few basics to get you started, but there are many more commands and options for managing this and other projects found in the and-cli.

  • and-cli dotnet --restore - restore the dotnet solution
  • and-cli dotnet - running backend project
  • and-cli dotnet-test --by-project - running backend automated tests
  • and-cli dotnet -- --cli test db migrate - migrate the test database (Clean and Restore the project before running. Done with: and-cli dotnet -cRb)
  • and-cli migration --add MigrationName - generates an EF Core database migration based on code-first changes
  • and-cli migration --run MigrationName - runs (or reverts to) a specified EF Core database migration
  • and-cli webpack - running frontend
  • and-cli webpack-test - running frontend tests
  • and-cli webpack --restore - restore npm dependencies for frontend
  • npm run all-tests - runs all of the test suites (backend, functional, frontend) and runs a storybook build (run from the root of the repo)
  • cd frontend && npm run cypress:open - run functional test suite interactively
  • cd frontend && npm run cypress:open:working - run functional test suite interactively against working
  • cd frontend && npm run cypress:run - run functional test suite headlessly
  • cd frontend && npm run cypress:run:working - run functional test suite headlessly
  • cd frontend && npm run test:debug - starts web socket connection for easy editor independent interactive debugging https://create-react-app.dev/docs/debugging-tests/

5. Getting Started

Restore the dotnet packages (first time only)

and-cli dotnet --restore

Restore the NPM node modules (first time only)

and-cli webpack --restore

Start the dotnet server

and-cli dotnet

Start the webpack server

and-cli webpack

Open your browser and navigate to:

https://localhost:5001

Documentation

Engineering Documentation

Engineering Documentation covers the codebase (i.e. patterns, style, and best practices), software development, building, and deploying the project.

External Resources

External Resources cover requirements, high level architecture, design, and project management for the project.

Adding Documentation

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Winton DeShong

๐Ÿ’ป โš ๏ธ ๐Ÿšง ๐Ÿ‘€

Brandon Scott

๐Ÿ’ป โš ๏ธ ๐Ÿ‘€

Dylan Justice

๐Ÿ’ป โš ๏ธ ๐Ÿ‘€

Stefanie Leitch

๐Ÿ’ป ๐Ÿ‘€ ๐Ÿ“–

This project follows the all-contributors specification. Contributions of any kind welcome!

andculturecode.dotnetreact.boilerplate's People

Contributors

allcontributors[bot] avatar brandongregoryscott avatar coykwan avatar dependabot[bot] avatar dylanjustice avatar jdahlinrsm avatar kevinbusch avatar myty avatar rllowman avatar stefanie899 avatar wintondeshong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

andculturecode.dotnetreact.boilerplate's Issues

Abstract LoggingProvider

  • Extract Core.Providers.Logging.LoggingProvider into base abstract provider in AndcultureCode.CSharp.Core -- should remove all references to serilog

  • Create SerilogLoggingProvider subclass in new AndcultureCode.CSharp.Providers.Logging.Serilog

  • Core.Extensions.Startup.IServiceCollectionExtensions#AddSerilogServices in AndcultureCode.CSharp.Providers.Logging.Serilog

Move ObjectValidator to Core package

Extract ObjectValidator and related actors into AndcultureCode.JavaScript.Core package

  • Move tests
  • Break all interfaces, constants, functions into separate files

Extract remaining Jobs related actors to respective packages

Business.Core

  • Business.Core.Interfaces.Conductors.Jobs.IJobEnqueueConductor -> AndcultureCode.CSharp.Core
  • Business.Core.Models.Entities.Job -> AndcultureCode.CSharp.Core
  • Business.Core.Models.Workers.IJobCancellationToken -> AndcultureCode.CSharp.Core - Needs to have IJobCancellationToken abstracted to not have a hard dependency on Hangfire
  • Business.Core.Interfaces.Workers.IWorker -> AndcultureCode.CSharp.Core - Needs to have IJobCancellationToken abstracted to not have a hard dependency on Hangfire

Business.Conductors

  • Business.Conductors.JobEnqueueConductor -> AndcultureCode.CSharp.Conductors
  • Business.Conductors.IServiceCollectionExtensions#AddConductors -> Create extension method for projects to selectively configure jobs related conductors in DI

Other

  • Business.Core.Models.Configuration.HangfireSqlServerConfiguration -> AndcultureCode.CSharp.Workers.Hangfire
  • Business.Core.Models.Configuration.HangfireWorkerConfiguration -> AndcultureCode.CSharp.Workers.Hangfire
  • Infrastructure.Data.SqlServer.Maps.Jobs.JobMap -> AndcultureCode.CSharp.Data.SqlServer
  • Infrastructure.Data.SqlServer.GBApiContext -> Migrate Jobs related code into base Context class in AndcultureCode.CSharp.Data
  • Infrastructure.Workers.Hangfire -> Should be extracted into own github package of 'AndcultureCode.CSharp.Workers.Hangfire
  • Presentation.Web.Controllers.Api.V1.Jobs.JobsController -> AndcultureCode.CSharp.Web
  • Presentation.Web.Models.Dtos.Jobs.JobDto -> AndcultureCode.CSharp.Web
  • Presentation.Web.Models.MappingProfile -> Extract into base MappingProvide provided via AndcultureCode.CSharp.Web
  • Presentation.Web.Validators.Jobs.JobValidator -> AndcultureCode.CSharp.Web
  • Presentation.Worker -> Extract into new generic github package of AndcultureCode.CSharp.Workers

Extract remaining Permissions related actors to respective packages

While many of the basic actors around permissions are moved to core, there are more actors to move.

  • Business.Conductors.PermissionConductor (to) AndcultureCode.CSharp.Conductors
  • Business.Core.Models.Security.AclStrings (to) AndcultureCode.CSharp.Core - likely abstract class / utilities aiding in creating project-level AclStrings files
  • Infrastructure.Data.SqlServer.Maps.Acls.AclMap (to) AndcultureCode.CSharp.Data.SqlServer
  • Infrastructure.Data.SqlServer.GBApiContext (to) Move Acl related entity into base Context
  • Presentation.Web.Attributes.AclAuthorizeAttribute (to) AndcultureCode.CSharp.Web
  • Presentation.Web.Filters.Authorization.AclAuthorizationFilter (to) AndcultureCode.CSharp.Web
  • Presentation.Web.Requirements.AclAuthorizationRequirement (to) AndcultureCode.CSharp.Web

Add database persisted settings handling

In most projects we inevitably need a means to store settings in the database, as opposed to application settings/env vars. Referencing gravity boots and/ or other projects. Add settings actors (ie. conductors, entity, mappings, etc...).

Extract Presentation.Web.ApiController

Move controller to AndcultureCode.CSharp.Web

Consider additionally refactoring UserAgent and GetCustomErrorMessage to better leverage extension methods.

Upgrade to .NET 6

Update the dotnet projects to run on .NET v6 (current LTS version)

Rename default branch from "master" to "main".

Feature request

What is the expected behavior?
To have the default branch named main instead of master

What is motivation or use case for adding/changing the behavior?
Removing terminology in technology evocative of racial inequality.

How should this be implemented in your opinion?
Following Scott Hanselman's advice

  1. Move master to main (maintains branch history)
git branch -m master main
git push -u origin main
  1. Update the default branch in repo settings from master to main.
  2. Repoint HEAD, and delete master branch.
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
git push origin --delete master

Are you willing to work on this yourself?
no

Extract Presentation.Web localization resources

While the major actors in localization were ported, there are some pieces around setup of those actors in startup.

Presentation.Web.Extensions.Startup

  • AddAndcultureCodeLocalization

  • ConfigureRequestLocalizationOptions

  • ConfigureRewriteOptions

  • ConfigureRouteOptions

  • Presentation.Web.Filters.Swagger.LocalizationDocumentFilter - AndcultureCode.CSharp.Web

  • Presentation.Web.Middleware.Localization.CultureRouteConstraint

  • Presentation.Web.Middleware.Localization.JsonRequestCultureProvider

  • Presentation.Web.Middleware.Localization.JsonStringLocalizer

  • Presentation.Web.Middleware.Localization.JsonStringLocalizerFactory

Investigate Improvements to Logging

This task is to inventory the various aspects of the backend's logging and determine which portions may need more and others needs less to better hone in the logging output.

Extract Presentation.Web Attributes

  • Presentation.Web.Attributes.ApiRouteAttribute
  • Presentation.Web.Attributes.BasicAuthAttribute
  • Presentation.Web.Attributes.NoCacheAttribute

Abstract Presentation.Web related extension methods

There are a few key extension methods we heavily use across projects that could be extracted into the AndcultureCode.CSharp.Web package.

  • IApplicationBuilderExtensions#ConfigureSeedData
  • ModelStateExtensions
  • AuthorizationFilterContextExtensions
  • IServiceCollectionExtensions.AddAndcultureCodeLocalization
  • IServiceCollectionExtensions.AddMiddleware -> make a more specific optional AddRequestThrottling that allows a project to 'enable' rate limiting functionality. Should not remain as generic AddMiddleware
  • IServiceCollectionExtensions.ConfigureRequestLocalizationOptions
  • IServiceCollectionExtensions.ConfigureRewriteOptions - Should be either bundled with another similarily named or pulled into its own that spells out what rewrite options it is configuring. Not kept generic
  • IServiceCollectionExtensions.ConfigureRouteOptions - Same as above, should be grouped with similar and explicitly named functionality around localization
  • IServiceCollectionExtensions.ConfigureForwardedHeaders - fixed by rsm-hcd/AndcultureCode.CSharp.Web#6

Enable endpoint routing

Re-enable dotnet core endpoint routing

Ensure MVC routing works as expected, along with culture constraints

Port 'Frontend Performance Profiling' documentation

NOTE: Must be an andculture employee to work on this issue due to requiring access to private resources.

Port over the new documentation on setting up frontend performance profiling for React. Do not include the results, or any references to that internal project, but try to reword any instructions/hints with more general terminology.

Update React Boilerplate

  • scrub AndcultureCode and replace with RSM.HCD
  • update package dependencies
    • Frontend (hcd-javascript)
    • Backend (RSM.HCD.CSharp)

Build Notifications

Remove Slack build notifications and replace with something else...maybe?

Extract Test related CLI commands

Extract the test related CLI commands in the project to the AndcultureCode.CSharp.Cli package

  • TestCommand
  • TestDatabaseCommand
  • TestDatabaseMigrateCommand

Extract Data.SqlServer actors

There are a variety of actors in this boilerplate that are prime candidates for abstraction to AndcultureCode. While we could very likely have an AndcultureCode.CSharp.Data general package, lets start by getting the one we use most... AndcultureCode.CSharp.Data.SqlServer.

  • Data.SqlServer.Extensions.EntityTypeBuilderExtensions
  • Data.SqlServer.Extensions.IServiceCollectionExtensions
  • Data.SqlServer.Extensions.ModelBuilderExtensions
  • Data.SqlServer.Extensions.Repository
  • Data.SqlServer.Extensions.Context
  • Data.SqlServer.Extensions.GBApiContext
  • Data.SqlServer.Extensions.Maps.Map
  • Data.SqlServer.Extensions.GBApiConnection

Extract remaining EnumerableExtensions to Extensions package

There are a few remaining untested EnumerableExtensions methods. This issue involves moving these methods to AndcultureCode.CSharp.Extensions and writing unit tests. That package is at 100% coverage so while we don't require it be exactly 100%, we would like to remain above 90% being we've attained that level now.

AndcultureCode.CSharp.Extensions

  • public static IEnumerable DistinctBy<T, TKey>(this IEnumerable source, Func<T, TKey> property)
  • public static IEnumerable DistinctBy<T, TKey>(this List source, Func<T, TKey> property)
  • public static IEnumerable<IEnumerable> GroupAdjacentBy(this IEnumerable source, Func<T, T, bool> predicate)
  • public static void AddTo(this List self, IEnumerable newItems)

Extract Presentation.Web.Tests IActionResultMatcherExtensions

There are some valuable testing matcher extensions in the presentation.web.tests project that should be pretty easy to move to the AndcultureCode.CSharp.Testing package. In doing so, please take care not to pull in large aspnet dependencies into the testing package and only the smallest package from the BCLs as to not force other testing projects to consume them.

Authentication defaults

Mistakenly set authentication defaults with oauth as true. This doesn't make the boilerplate, out-of-the-box, as easy to use as it requires folks to configure them. Instead, make the defaults for google and microsoft auth to have IsEnabled be false

Authentication and Authorization Strategy

Boilerplate should provide authentication and authorization strategies out of the box.

For starters Cookie Authentication and JWT token strategies would allow new applications to have users, roles, acls, login/logout and all the common functionality they would otherwise need to setup up front.

  • Cookie Authentication
  • OAuth Authentication
  • UserLoginsController#Create (login)
  • UserLoginsController#Delete (logout)

Upgrade to latest AndcultureCode JS Core, React packages

With the latest packages being pushed out with updated dependencies, we'll want to pull them in here and make sure they're still working as expected. (Also just to keep them up-to-date in general!)

andculturecode-javascript-core @ 0.5.2

andculturecode-javascript-react @ 0.3.4

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.