This application is designed to demonstrate a full stack .NET application using Razor Pages ASP.NET Framework.
It allows users to track habits and visualize entry data in a chart. They can create, update and delete habits and habit entries.
- Create, update and delete operations with confirmation modal
- Paginated view
- Active page indicator
- Page navigation buttons
- First page
- Previous page
- Next page
- Last page
- Page size dropdown options
- Sorting in ascending or descending order
- Name column
- Measurement column
- Favorite column
- Created column
- Filtering
- Measurement dropdown options
- Favorite dropdown options
- Search by name or measurement
- Create update and delete operations
- Paginated view
- Active page indicator
- Page navigation buttons
- First page
- Previous page
- Next page
- Last page
- Page size dropdown options
- Sorting in ascending or descending order
- Date column
- Quantity column
- Filtering
- Date range
- Quantity range
- Allows users to mark habits as favorite for fast and easy access to most used habits
- Client side validation
- using built-in JQuery form validation with data annotation attributes on input models
- Server side validation
- using
ModelStatechecks with data annotation attributes on input models - using
FluentValidationlibrary to enforce invariants and avoid broken entity states - using
Resultpattern with strongly typedErrorsfor business rules
- using
- Form validation errors appear under input fields
- Server side validation errors are used for conditional rendering of pages
- Grouping habit quantities by day and displaying the values in a chart
- Charts are generated using
ChartJSlibrary in a collocated javascript file
- Connection string can be changed in
appsettings.jsonConnectionStrings-Default
- SQlite database file is created on startup in
HabitGains.Webproject folder if it doesn't already exist - Database is initialized with
habitandentrytables
- Data seeding on startup can be enabled or disabled in
appsettings.jsonSeedingdatabase seeding optionsSeedOnStartupenable or disable startup seeding (true/false)EntriesPerHabitamount of entries to insert per habit (10-100)
- Seeding is only performed if no records are present in database tables
- Options are validated during startup - invalid options prevent the application from running
- Seeding inserts 15 habits into the database with a selected amount of entries per habit
- Entries per habit values range from 10 to 100
- Seeding is enabled in
Developmentenvironment and disabled when running inProductionenvironment
- using Bootstrap themes to switch between dark and light mode
- .NET 10 SDK (download link)
-
Clone the repository
- using HTTPS
https://github.com/nwdorian/HabitGains.git
- using SSH
git@github.com:nwdorian/HabitGains.git
- using GitHub CLI
gh repo clone nwdorian/HabitGains
- using HTTPS
-
Configure
appsettings.jsonoptions if needed- replace the connection string
- details in Database Initialization section
- edit data seeding settings
- details in Database Seeding section
- replace the connection string
-
Run the application from project root folder
dotnet run --project ./src/HabitGains.Web
Contributions are welcome! Please fork the repository and create a pull request with your changes. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or feedback, please open an issue.