CSharp Side Hustle – Set Up Your Project And Git Repository

Where do we start? At the beginning. The very beginning. This material is so basic I almost skipped over it. But … there are some very explicit reasons why you set up your CSharp project and git repository for a side hustle project in this manner. And specific reasons why you choose certain tools. This is the first step to creating a web application using Angular ASP DotNet with Authentication. Basic flow shown in the video. More explanation in the article below.

As a reminder, a side hustle project should be a line of business application (do not try building the next facebook or re-inventing email). A side hustle project should be bootstrapped and self-sustaining.

Keep your side hustle project as simple as possible: one visual studio solution, one docker image, one git repository, one host. Do not over-complicate your web application prematurely. You will have several months of low traffic before you need to scale.

Overall Architecture – Javascript SPA (Angular) + Web API Back End (ASP DotNet Core) + PostgreSQL database via Entity Framework Core. There are some newer frameworks available, but for a side hustle new technology is a project killer. Stick to what you know. In my case Angular is well-supported in dotnet and is what I have the most experience with.

Install Tooling

Microsoft Visual Studio Community 2017 – Sign up for the free developer account, Visual Studio Dev Essentials. It seems the trend is away from Visual Studio in ASP DotNet Core project tutorials. I do not know why. Maybe the emphasis is on the cross-platformability of DotNet core. But the vast majority of DotNet developers are working in Windows. Visual Studio Community is free for individual developers. It has a much richer feature set than Visual Studio Code. Use it.

Notepad++ – It will save you the hassle of learning VI to write your commit messages for git.

Git for Windows – There is a git plugin with Visual Studio. Don’t do it. Learn git the way it was designed to be used … on the command-line. When installing accept all the defaults except for text editor. Select Notepad++. Thank me later.

Tortoise Git – nice for visualization. I use it for repository browsing only.

Scaffold Project from Template

You want Angular + Docker + Authentication. There is no perfect project template so it becomes a question of which project template will allow the least amount of manual grunt work.

  • Web API Template with Docker Support – we could use this one.
  • Angular SPA Template (without Docker Support) – this is probably the least work. It is easy to add docker files afterwards.
  • ASP DotNet MVC with Authentication – not really that helpful since it uses ASP DotNet Core Identity. In my experience I haven’t seen this working with an Angular client so I plan on using Identity Server.

Create Remote Repository and Push

This may be an unnecessary step for you. Since you’re only one person working on a side hustle project there is no need to coordinate or merge changes. You can do version management with a local git repository. The only thing you get from pushing to a remote repository is offsite backup – for the moment (in the future automated builds). So if you’ve got a rock solid backup mechanism in place maybe you want to keep your code in a local git repository.

Visual Studio Team Services – Free private git repositories as part of Visual Studio Dev Essentials. To be honest I use a self-hosted gerrit instance at work. I’m trying out the git repositories on VSTS for private code hosting. But Git is definitely the tool you want to know for managing your source code – especially since Microsoft Bought Git Hub. Why not use GitHub? Of course I agree GitHub is the fountain of all goodness. But … it costs $7/month for a private repository. When your project is earning $7/month you can choose to spend it on GitHub source code hosting. In the meantime use a free option since there is one available.

Conclusion

Keep it simple. There are so many ways that you could make this more complex than it needs to be. I’ve seen projects that separate the javascript client from the backend api. Different repository and different hosts, cross-origin requests (look that one up). Docker makes that more doable and maybe you will end up there with your side hustle project over time. But for now don’t over complicate things.

Opt for free over paid when the functionality is equivalent. Even if it is less cool. I know exactly zero individual devs who put their code in a git repository at VSTS for side hustle projects. Or who would rather be trying JetBrains Rider instead of Visual Studio Community? Keep your project self-sustaining.

In the next article we’re going to set up the project for docker support and hook up the database to back some web api calls.