A full-stack notes application with ASP.NET Core Web API backend and React frontend. This application allows users to create, list, update, and delete notes with a modern, responsive user interface.
- Create Notes: Add new notes with title and content
- List Notes: View all your notes in an organized manner
- Update Notes: Edit existing notes
- Delete Notes: Remove notes you no longer need
- Modern UI: Built with React and TypeScript for a smooth user experience
- RESTful API: Clean and well-structured API built with ASP.NET Core
- ASP.NET Core Web API 10.0 - RESTful API framework
- .NET 10 - Runtime and framework
- In-Memory Storage - For data persistence
- Swagger/OpenAPI - API documentation and testing
- React 19 - UI library for building user interfaces
- TypeScript 5.9 - Type-safe JavaScript
- Vite 7 - Fast build tool and development server
- ESLint - Code quality and linting
- CSS3 - Styling
notes-service/
βββ .github/
β βββ instructions/ # Project instructions and guidelines
βββ Docs/ # Documentation
β βββ project-structure.md # Detailed project structure reference
βββ src/ # Source code
β βββ Notes.Api/ # Backend API (.NET)
β β βββ Controllers/ # API endpoints
β β βββ DTOs/ # Data Transfer Objects
β β βββ Models/ # Domain models
β β βββ Repositories/ # Data access layer
β β βββ Services/ # Business logic
β β βββ Program.cs # Application entry point
β βββ notes-ui/ # Frontend UI (React + TypeScript + Vite)
β βββ src/
β β βββ api/ # API client
β β βββ components/ # Reusable UI components
β β βββ hooks/ # Custom React hooks
β β βββ pages/ # Page components
β β βββ types/ # TypeScript type definitions
β β βββ App.tsx # Main app component
β β βββ main.tsx # Application entry point
β βββ package.json # Dependencies and scripts
β βββ vite.config.ts # Vite configuration
βββ README.md # This file
For detailed project structure information, see project-structure.md.
Before you begin, ensure you have the following installed:
- .NET SDK (version 8.0 or later)
- A code editor (Visual Studio, Visual Studio Code, or JetBrains Rider recommended)
- Node.js (version 18.x or later)
- npm package manager (comes with Node.js)
- A code editor (Visual Studio Code recommended)
-
Navigate to the backend directory
cd src/Notes.Api -
Restore dependencies
dotnet restore
-
Build the project
dotnet build
-
Run the application
dotnet run
The API will be available at:
- HTTP:
http://localhost:5138 - HTTPS:
https://localhost:7257
The API includes Swagger UI for testing and documentation, accessible at http://localhost:5138/swagger when the application is running.
-
Navigate to the frontend directory
cd src/notes-ui -
Install dependencies
npm install
-
Configure environment variables (optional)
Copy the example environment file:
cp .env.example .env
The default configuration connects to
http://localhost:5138/api. Update.envif your backend runs on a different port:VITE_API_BASE_URL=http://localhost:5138/api
-
Start the development server
npm run dev
The frontend application will be available at http://localhost:5173 (default Vite port).
-
Build for production
npm run build
-
Preview production build
npm run preview
-
Lint code
npm run lint
To run the complete application, you need to start both the backend and frontend servers:
-
Start the Backend (in terminal 1)
cd src/Notes.Api dotnet runWait for the message indicating the server is running (usually shows
Now listening on: http://localhost:5138) -
Start the Frontend (in terminal 2)
cd src/notes-ui npm run devThe frontend will open at
http://localhost:5173 -
Access the Application
- Frontend UI:
http://localhost:5173 - Backend API:
http://localhost:5138 - Swagger UI:
http://localhost:5138/swagger
- Frontend UI:
The frontend will automatically communicate with the backend API to perform CRUD operations on notes.
The Notes Service API provides a RESTful interface for managing notes. All endpoints are prefixed with /api/notes.
- Development:
http://localhost:5138/api - Swagger UI:
http://localhost:5138/swagger
GET /api/notesResponse:
- 200 OK: Returns an array of notes
- 500 Internal Server Error: Server error occurred
Example Response:
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"title": "My First Note",
"content": "This is the content of my note",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
]GET /api/notes/{id}Parameters:
id(path parameter): GUID of the note
Response:
- 200 OK: Returns the requested note
- 404 Not Found: Note doesn't exist
- 500 Internal Server Error: Server error occurred
POST /api/notesRequest Body:
{
"title": "My New Note",
"content": "This is the content"
}Response:
- 201 Created: Note created successfully
- 400 Bad Request: Invalid request data
- 500 Internal Server Error: Server error occurred
Example Response:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"title": "My New Note",
"content": "This is the content",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}PUT /api/notes/{id}Parameters:
id(path parameter): GUID of the note to update
Request Body:
{
"title": "Updated Title",
"content": "Updated content"
}Response:
- 200 OK: Note updated successfully
- 404 Not Found: Note doesn't exist
- 400 Bad Request: Invalid request data
- 500 Internal Server Error: Server error occurred
DELETE /api/notes/{id}Parameters:
id(path parameter): GUID of the note to delete
Response:
- 204 No Content: Note deleted successfully
- 404 Not Found: Note doesn't exist
- 500 Internal Server Error: Server error occurred
{
id: string; // GUID
title: string; // Note title
content: string; // Note content
createdAt: string; // ISO 8601 datetime
updatedAt: string; // ISO 8601 datetime
}{
title: string; // Note title (required)
content: string; // Note content (required)
}{
title: string; // Updated title (required)
content: string; // Updated content (required)
}Port already in use
- Error:
Address already in use - Solution: Change the port in
src/Notes.Api/Properties/launchSettings.jsonor stop the process using the port
Build errors
- Ensure you have .NET 8.0 or later installed:
dotnet --version - Try cleaning the build:
dotnet cleanthendotnet build
Port 5173 already in use
- Solution: The dev server will automatically try the next available port (5174, 5175, etc.)
- Or manually specify a port in
vite.config.ts
API connection errors
- Check that the backend is running on
http://localhost:5138 - Verify the
VITE_API_BASE_URLin your.envfile - Check browser console for CORS errors
Node modules issues
- Delete
node_modulesfolder andpackage-lock.json - Run
npm installagain
ESLint errors
- Run
npm run lintto see all linting issues - Most formatting issues can be auto-fixed
CORS errors when connecting frontend to backend
- The backend is configured to allow requests from
http://localhost:5173 - If using a different port, the backend CORS policy needs to be updated in
Program.cs
Changes not reflecting
- Backend: Restart the
dotnet runprocess - Frontend: Vite has hot module replacement (HMR), but sometimes a browser refresh is needed
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature-name) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature-name) - Open a Pull Request
- Follow the existing code style and conventions
- Write clear, descriptive commit messages
- Test your changes thoroughly before submitting
- Update documentation as needed
- Ensure your code passes all linting and build checks
This project is licensed under the MIT License - see the LICENSE file for details (to be added).
For questions, issues, or suggestions, please open an issue in the GitHub repository.
Built with β€οΈ using ASP.NET Core and React