DEV Community

YJDoc2
YJDoc2

Posted on

How do you structure your Projects ? πŸ—ƒοΈπŸ“¦οΈ

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!

Top comments (2)

Collapse
 
yjdoc2 profile image
YJDoc2

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, main.rs in root and related files in bin/ folder, and for a lib, lib.rs 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)

Collapse
 
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.