DEV Community


How do you structure your Projects ? 🗃️📦️

yjdoc2 profile image YJDoc2 ・1 min read

What are the ways you structure your projects ? Any language, any framework.
I personally believe that a good project structuring is vital to make the project maintainable, and I would like to hear about how do you structure your projects.
Thank you!

Discussion (2)

yjdoc2 profile image
YJDoc2 Author

My usual structuring is :

C : Keep all files and headers in single folder, if project is small and does not contain many source files, otherwise split the files according to use (utility, data structures etc) and make individual folder+makefile for each

node+express+Mongoose : index.js in root which sets up routes, db connection,middlewares etc. and starts server ; Models folder for Mongoose models, utils folder if I have some modular utility functions that can be used in multiple projects, config folder for storing DB, Authentication etc config files, routes folder containing individual files for each major routing path (/user, /admin, /api etc.) and each sets up functions and routes and then exports the routers. If using server-side rendering, then a views folder for views.

python : main/user interface containing files in root, and then other functions/classes split in modules/ individual folders as per needed

Rust : For binary, in root and related files in bin/ folder, and for a lib, in root exporting the interface of library and core folder containing all library's core code, which itself is split according to use in folders. (I'm still exploring structuring for Rust, not sure this is a good way or not)

andrewbaisden profile image
Andrew Baisden

I just let the framework set up the boilerplate and then clean out the files I don't need 😂 If its a Node project I just follow MVC.

Forem Open with the Forem app