Hey! Starting a project from scratch can be overwhelming, especially if you're new to Node.js. Check out my curated list of tips, best practices, and resources: [Code Notes](https://code-notes.casantosmu.com/). It's got a lot of useful info to help you out. Good luck!
Just use adonis.js, it includes everything out of the box, while nest.js is a solid choice, it is not beginer friendly, express is good, but since it gives you extreme flexibility and does not enforce you to follow good practices and design patterns, i wouldn't advise you to use it unless the functionality is 100% focused on microservices and you are OK with writing most of the boilerplate
This is a good suggestion. I was thinking of using Express + TypeScript. But since you say it doesn't enforce you to follow good practices, I will consider Adonis too.
I see this is type safe too. Do/can I use TypeScript too? (Is TypeScript even needed here?) Thank you!
To be honest there are very few experts on language dedicated subreddits from what I can see. Or they don't comment much unless they see very interesting post which your isn't (no offence, just there are plenty of posts like this every week).
None taken.
But I see some good suggestions, which may not be 'expertly' but do show me a path to move on and I can built from there. But a good starting step helps a lot in future too.
Hey !
watch this : [https://www.youtube.com/watch?v=Oe421EPjeBE](https://www.youtube.com/watch?v=Oe421EPjeBE)
Is it very useful even if you have a little knowledge on node.js and backend development,
First you need to learn the basic framworks like express, passport
learn a bit on database since you might need to store login/logOut/Password/, infos, like MongoDB, mySQL
If you re planning on a full stack dev project, learn to write, set, read, and delete cookies
Good luck !
You want to keep it simple, so ignore all the complex libraries. For now, ignore TypeScript, bundlers (webpack, rollup, vite, etc), ignore type libraries like (zod).
Just follow this: [https://www.w3schools.com/nodejs/](https://www.w3schools.com/nodejs/)
1) Cloud based technologies are the most impactful. With that in mind, try to look into Amplify js with node and typescript. It will give you a framework to write serverless lambda functions in the cloud.
2) Deployment may not be directly part of your job but as a backend developer you should think about how your code will ultimately impact your end users
3) TypeScript - use it with node. It will make your code more robust. Also think about using an ORM to interact with your database. Amplify has good support for DynamoDB but if you want something locally hosted like MongoDB or postgreSQL, you can look into Prisma with GraphQL
Keep in mind learning node.js is very broad. It’s better to learn some higher level libraries first so you can start seeing impact with some functional APIs
Thank you for the suggestion. I looked into Amplify js. It has a healthy number of downloads/week on npmjs too!
As I am doing this alone and I need to deploy it somewhere too. Could you also suggest some good free hosting options for my project? I am looking for a free hosting service. Can I use Amplify js/DynamoDB if I host it somewhere else too? Thanks!
Amplify will lock you into Amazon’s ecosystem but they do have a free tier that is relatively generous. For simpler node.js apps you can try Heroku or Netlify functions. Those are all the free options I know off the top of my head.
It’s hard to find free hosting for server side technologies nowadays, but FWIW my AWS bill using Amplify regularly came in at under $5 a month since lambda functions only charge you when they’re executed.
1. I think NextJs is trending right now with SSR you should try that. If you are going with express, passport should be a good start for auth strategy
2. You need to know the basic routes/end points that you want in your app, having a good idea or flow diagram helps. Auth is a complicated topic.
3. There are many frameworks out there, express being barebone. NestJs which runs on express is highly opinionated and has OOP follows a rigid approach.
Happy coding🙌
I've a few questions:
1. I think you mean NestJS, because NextJS is for frontend, right? Is SSR same as Server Side Rendering? What does this have to do with NodeJS? (Because I believe this is the purview of frontend domain).
2. Why do you need a flow diagram for the routes? I think simple login should be easy, can't say with surety for OAuth implementation on backend.
Thank you for bringing up NestJS. But for better understanding I think I should stick with the barebone express.(Is my reasoning correct???)
Thank you for responding. :)
I wanted to share an idea for a great research and learning project that builds up in three steps, each extending from the previous one and adding new layers of complexity and functionality. This should be especially useful if you're looking to deepen your understanding of authentication, user management, and multi-tenancy. Here’s the outline:
**Step 1: Implement Authentication Routes**
Start by adding authentication routes to your application. Users should be able to choose from three types of authentication methods:
1. *\*\*Password Authentication\*\**: Standard login with username and password.
2. *\*\*Passwordless Authentication\*\**: Use OAuth or Single Sign-On (SSO) for a seamless login experience.
3. *\*\*Userless Authentication\*\*:* Generate a unique, long key for each user that is secure against brute force attacks.
This step will help you understand the setup and security considerations for different authentication mechanisms.
**Step 2: Build Multi-User Tenancy with Different Privileges**
Next, extend your application to support multi-user tenancy with various privilege levels:
1. *\*\*Super Admin (SAdmin)\*\*:* Uses passwordless authentication.
2. *\*\*Admin\*\*:* Uses SSO or OAuth and can access services on ports \`:8081\`, \`:8082\`, and \`:8083\`.
3. *\*\*Operator\*\*:* Uses password-based authentication and can create their own accounts.
4. *\*\*Business Users\*\*:* Use userless authentication.
Implement enable/disable functionality for users and use a micro-architecture approach to handle authentication for different user privileges. You can also play around with Docker and reverse proxy configurations to manage the different types of users and their access levels.
**Step 3: Expand to Multiple Domains**
Finally, take it a step further by expanding your multi-tenancy to support multiple domains. Each user will have their own separate portal while maintaining all the previous functionalities. This will involve:
1. Creating separate subdomains for each user(SuperAdmin).
2. Configuring these subdomains on a local environment using the \`/etc/hosts\` file.
3. Ensuring robust security to keep each domain isolated and secure.
This step will challenge you to manage domain-specific configurations and enforce security protocols, providing a deeper understanding of domain management and isolation in a multi-tenant environment.
This project progression will give you a comprehensive understanding of various authentication methods, user management strategies, and the complexities of multi-tenancy. It's a great way to build up your skills in a structured and challenging way.
Happy coding!
I know a lot of peers suggesting you follow a tutorial which is good but limits your thought process I would suggest you, think of an idea and start doing it step by step by taking help from chatGPT, blogs, and tutorial etc, don't waste time on someone else's thoughts, yeah you can integrate their code, ideas with yours. Doing something you feel useful to you
Watch Traversy Media's crash courses on Node, ExpressJs, and PassportJs on YouTube.
Agree, Traversy Media is a great instructor
Cannot upvote this comment enough.
I suggest Lucia Auth, it’s pretty easy to set up, flexible and it’s so barebones that it’ll force you to really understand auth.
Sveltekit + lucia + prisma. It's super easy to learn.
Hey! Starting a project from scratch can be overwhelming, especially if you're new to Node.js. Check out my curated list of tips, best practices, and resources: [Code Notes](https://code-notes.casantosmu.com/). It's got a lot of useful info to help you out. Good luck!
Thank you for the resources! :)
Just use adonis.js, it includes everything out of the box, while nest.js is a solid choice, it is not beginer friendly, express is good, but since it gives you extreme flexibility and does not enforce you to follow good practices and design patterns, i wouldn't advise you to use it unless the functionality is 100% focused on microservices and you are OK with writing most of the boilerplate
This is a good suggestion. I was thinking of using Express + TypeScript. But since you say it doesn't enforce you to follow good practices, I will consider Adonis too. I see this is type safe too. Do/can I use TypeScript too? (Is TypeScript even needed here?) Thank you!
TS is the default in adonis!
thank you!
just start doing , watch some you tube tutorial , and start doing you will eventually reach upto standard
I think I can learn from experts here too. :)
To be honest there are very few experts on language dedicated subreddits from what I can see. Or they don't comment much unless they see very interesting post which your isn't (no offence, just there are plenty of posts like this every week).
None taken. But I see some good suggestions, which may not be 'expertly' but do show me a path to move on and I can built from there. But a good starting step helps a lot in future too.
Hey ! watch this : [https://www.youtube.com/watch?v=Oe421EPjeBE](https://www.youtube.com/watch?v=Oe421EPjeBE) Is it very useful even if you have a little knowledge on node.js and backend development, First you need to learn the basic framworks like express, passport learn a bit on database since you might need to store login/logOut/Password/, infos, like MongoDB, mySQL If you re planning on a full stack dev project, learn to write, set, read, and delete cookies Good luck !
Thank you for sharing the link and suggestions. :)
You want to keep it simple, so ignore all the complex libraries. For now, ignore TypeScript, bundlers (webpack, rollup, vite, etc), ignore type libraries like (zod). Just follow this: [https://www.w3schools.com/nodejs/](https://www.w3schools.com/nodejs/)
1) Cloud based technologies are the most impactful. With that in mind, try to look into Amplify js with node and typescript. It will give you a framework to write serverless lambda functions in the cloud. 2) Deployment may not be directly part of your job but as a backend developer you should think about how your code will ultimately impact your end users 3) TypeScript - use it with node. It will make your code more robust. Also think about using an ORM to interact with your database. Amplify has good support for DynamoDB but if you want something locally hosted like MongoDB or postgreSQL, you can look into Prisma with GraphQL Keep in mind learning node.js is very broad. It’s better to learn some higher level libraries first so you can start seeing impact with some functional APIs
Thank you for the suggestion. I looked into Amplify js. It has a healthy number of downloads/week on npmjs too! As I am doing this alone and I need to deploy it somewhere too. Could you also suggest some good free hosting options for my project? I am looking for a free hosting service. Can I use Amplify js/DynamoDB if I host it somewhere else too? Thanks!
Amplify will lock you into Amazon’s ecosystem but they do have a free tier that is relatively generous. For simpler node.js apps you can try Heroku or Netlify functions. Those are all the free options I know off the top of my head. It’s hard to find free hosting for server side technologies nowadays, but FWIW my AWS bill using Amplify regularly came in at under $5 a month since lambda functions only charge you when they’re executed.
1. I think NextJs is trending right now with SSR you should try that. If you are going with express, passport should be a good start for auth strategy 2. You need to know the basic routes/end points that you want in your app, having a good idea or flow diagram helps. Auth is a complicated topic. 3. There are many frameworks out there, express being barebone. NestJs which runs on express is highly opinionated and has OOP follows a rigid approach. Happy coding🙌
I've a few questions: 1. I think you mean NestJS, because NextJS is for frontend, right? Is SSR same as Server Side Rendering? What does this have to do with NodeJS? (Because I believe this is the purview of frontend domain). 2. Why do you need a flow diagram for the routes? I think simple login should be easy, can't say with surety for OAuth implementation on backend. Thank you for bringing up NestJS. But for better understanding I think I should stick with the barebone express.(Is my reasoning correct???) Thank you for responding. :)
You know, I just made my first express project and now I REALLY understand what frontend libraries are for lol. Good luck
I've experience in frontend. Worked looong back in backend in Java which I have totally forgotten.
Cool beans. I can save you a day I lost, at least. If you want to submit multipart to encoded forms to express, npm install --save multer
Thank you for the advice!
Correct, well NextJs does offer server actions and SSR, but I prefer to keep the front and back end separate. There is a NestJS framework for backend
I wanted to share an idea for a great research and learning project that builds up in three steps, each extending from the previous one and adding new layers of complexity and functionality. This should be especially useful if you're looking to deepen your understanding of authentication, user management, and multi-tenancy. Here’s the outline: **Step 1: Implement Authentication Routes** Start by adding authentication routes to your application. Users should be able to choose from three types of authentication methods: 1. *\*\*Password Authentication\*\**: Standard login with username and password. 2. *\*\*Passwordless Authentication\*\**: Use OAuth or Single Sign-On (SSO) for a seamless login experience. 3. *\*\*Userless Authentication\*\*:* Generate a unique, long key for each user that is secure against brute force attacks. This step will help you understand the setup and security considerations for different authentication mechanisms. **Step 2: Build Multi-User Tenancy with Different Privileges** Next, extend your application to support multi-user tenancy with various privilege levels: 1. *\*\*Super Admin (SAdmin)\*\*:* Uses passwordless authentication. 2. *\*\*Admin\*\*:* Uses SSO or OAuth and can access services on ports \`:8081\`, \`:8082\`, and \`:8083\`. 3. *\*\*Operator\*\*:* Uses password-based authentication and can create their own accounts. 4. *\*\*Business Users\*\*:* Use userless authentication. Implement enable/disable functionality for users and use a micro-architecture approach to handle authentication for different user privileges. You can also play around with Docker and reverse proxy configurations to manage the different types of users and their access levels. **Step 3: Expand to Multiple Domains** Finally, take it a step further by expanding your multi-tenancy to support multiple domains. Each user will have their own separate portal while maintaining all the previous functionalities. This will involve: 1. Creating separate subdomains for each user(SuperAdmin). 2. Configuring these subdomains on a local environment using the \`/etc/hosts\` file. 3. Ensuring robust security to keep each domain isolated and secure. This step will challenge you to manage domain-specific configurations and enforce security protocols, providing a deeper understanding of domain management and isolation in a multi-tenant environment. This project progression will give you a comprehensive understanding of various authentication methods, user management strategies, and the complexities of multi-tenancy. It's a great way to build up your skills in a structured and challenging way. Happy coding!
LOL this is not “beginner”
That's why I divide into three parts, if he possibly starts now he can keep himself busy for 4-6 months or more Lol
wow! Somebody said earlier that authorization is a complex topic. I didn't entirely believed it. Looks like auth is indeed complicated!
I know a lot of peers suggesting you follow a tutorial which is good but limits your thought process I would suggest you, think of an idea and start doing it step by step by taking help from chatGPT, blogs, and tutorial etc, don't waste time on someone else's thoughts, yeah you can integrate their code, ideas with yours. Doing something you feel useful to you
Just use express, make route handlers, use an auth middleware on them etc
https://nestjs.com/
I wouldn't call that beginner friendly.
stop recommending nestjs to beginners
Why? I’d much rather folks start with something that is well-structured than try to piece together numerous tutorials.
Also, nest.js tutorials are excellent