This project is a full-stack template that demonstrates clean architecture and practical patterns across a modern stack:
For database setup instructions (JSON import or full dump restore), see the Database Setup –
db_propertiessection below.
- Backend: .NET 8 (C#) building a RESTful API with a layered design (Presentation → Business/Application → Data).
- Database: MongoDB, database
db_propertieswith two collections:ownersandproperties. - Frontend: React + Next.js with Jest for testing and SPA client navigation.
- Testing: xUnit + Moq on the backend; Jest on the frontend.
- API Client Generation: NSwag runs at build time to generate a typed TypeScript API client (
apiClient) consumed by the frontend.
The goal of the API is to retrieve properties and owners using filtering, pagination, and DTO mapping to keep transport contracts clean and stable. This project aims to be a solid starting template that highlights good architecture and design practices in .NET + React/Next.js.
- Home: Welcome/entry page that links to the app sections.
- Properties: Grid view of properties with a filter modal/dialog, server-driven pagination, and incremental data loading.
- Owners: Data table listing all registered owners.
- Property Detail: Full details for a selected property.
This repository is designed as a reference template:
- Show clean separations between layers and responsibilities.
- Demonstrate MongoDB integration with real-world concerns (filters, pagination, DTOs).
- Provide a generated client for the frontend to reduce manual boilerplate and mismatches.
- Offer an end-to-end example of .NET + Next.js with solid testing practices.
This project includes a MongoDB database backup so you can easily replicate the environment on your local machine.
The database name is db_properties by default.
This method uses mongodump/mongorestore to replicate the database, including indexes.
It is best if you want the database exactly as it was exported.
-
Extract the backup archive (if provided):
tar -xzvf db_backup.tar.gz
After extraction, you should see a folder like:
db_properties/ ├── users.bson ├── users.metadata.json ├── properties.bson ├── owners.bson ... -
Restore into MongoDB:
mongorestore --db db_properties ./db_properties
-
Verify the import:
mongosh use db_properties show collections
This method uses plain JSON files for each collection.
It is best for small sample data.
-
Make sure MongoDB is running locally (
mongodservice). -
Import each collection using
mongoimport. For example:mongoimport --db db_properties --collection users --file ./database/users.json --jsonArray mongoimport --db db_properties --collection properties --file ./database/properties.json --jsonArray mongoimport --db db_properties --collection owners --file ./database/owners.json --jsonArray
⚠️ Use the--jsonArrayflag if the JSON file contains an array of documents. -
Verify by connecting to MongoDB:
mongosh use db_properties show collections
- MongoDB Community Server (running locally)
- MongoDB Database Tools (for
mongodump,mongorestore,mongoimport,mongoexport) - Alternatively, you can use MongoDB Compass (GUI) to manually import/export JSON files.
To be able to run the application you ahve to follow the next steps:
- Setup your mongo Db connection after the databse has been created, in the following path:
\WebsiteServerApp\appsetting.json - Run the file
RunAPP.batlocated at the root of the repository. - Wait until it finishes and you will noticed that the browser will open the application with the correct urls and ports.
You can of course open the correct files to run the application manually.
- API - by running the solution
WebsiteServerApp\WebsiteServerApp.slnand running it. - Frontend - Accessing the folder
websiteclientappand running the commandnpm buildand thennpm startappornpm start
If something happend during this process, do not hesitate to contact me through email.