Hi to everyone, this is my first discussion on Hashnode.
I'm a newbie to the modern Javascript ecosystem. So far I have always used PHP with jQuery to create web application but from a month I've started the transition to the JS world.
As you know, there are billions of tutorials, courses, and videos but every author uses a different approach to build a modern Javascript application.
Among all tutorials I have read, I appreciate this but there are not a lot of features (like database implementation, route with parameters and others). I also like the classic Create React App but it's missing the Server Side Rendering.
My questions are:
Thanks to those who will answer!
I'd recommend trying this website called Boilrplate. It has a list of boilerplate templates on Github for each library (like React, NodeJS, etc).
For React I love create-react-app. I use GatsbyJS for static site generation, and I have a couple base site templates I use (though they have some in their docs). next.js is also very good for simplified React SSR as well. There are quite a few Redux starter kits out there, but I haven't found one I personally like yet.
For Node, this Hackathon Starter is pretty cool. Comes pre-baked with stuff like social login OAuth. Great code for dissecting or just cloning. I also have a small Node/Express/Mongoose based API that I use as a basis for any quick data-based APIs.
What JavaScript technology do I use?
Although I'm sure a lot of other Devs will hate me for this, I really like static websites. Theyr'e fast, they have the same functionality as non-static, and they're so much easier to set up!
Firebase, for example, gets me free hosting, a database, Auth integration, and storage for testing. I can then upgrade to production for a small amount per month, and it saves a lot of headaches.
Do I have a boilerplate to start every project?
Nope.
Hope this helps!
These days I've favored going entirely with JavaScript for my full stack, MEAN-ish if you will. I choose to organize my project as a monorepo to encapsulate all of the subsystems in the stack. I use Lerna to manage the monorepo. No boilerplate at this level yet except for my previous projects. Some day I'll compile my pattern together with Yeoman.
Stack Subsystems
I create an NPM package for each subsystem, all organized as subprojects of the monorepo. I create a frontend package, a backend package, a shared code package, an Nginx package, and a database package, if necessary. Each package, except for the shared package, also gets a Dockerfile so that each project is containerized. I use
docker-composeto orchestrate all of the subsystems together. Conveniently this pattern is also deployable to Amazon ECS if I want to deploy my project externally.Tooling
TypeScript is a must for me. Everything JS I implement with TypeScript.
I mostly use NPM scripts for automation. However, for more complicated tasks, I'll use Gulp and custom Node scripts using commander. Shell scripts are too esoteric most of the time.
For cloud-deployed projects, I use Terraform for codifying infrastructure definition.
I've also been investigating using Vault for secrets management.
Frontend
I prefer Angular 5 as my choice for frontend framework. So the Angular CLI is the scaffolding tool for me. The CLI will automatically bring in Angular, TypeScript, a CSS preprocessor of your choice (I use Sass), and Webpack. I usually add Angular Material for UI components as well and maybe Bootstrap 4.
Backend
My boilerplate code on the backend is currently just homegrown. But I'm excited to try out NestJS for the my next project.
I use Express solely as an API server since I'm leveraging Angular for single page application capabilities. However, I will use Angular Universal if the project calls for server-side rendering.
I also include Inversify for dependency injection and inversify-express-utils to improve how the Express code is structured. If I'm using a database, I'll include Sequelize or Mongoose (well actually their TypeScript counterparts sequelize-typescript and Typegoose).
Database
I usually prefer using a relational database over NoSQL. Postgres has been my DB of choice lately. If I go NoSQL, I'll use Mongo. Either way I use Sequelize or Mongoose as ORMs.
I apologize if all of that was information overload, but I figured that I would be thorough.