How annerh3/cookies-test works
Project type and purpose
• This is a full-stack web application demonstrating secure authentication using HTTP-Only cookies instead of localStorage.
• Front-end: React single-page application (client/auth-cookies) built with Vite and Tailwind.
• Back-end: ASP.NET Core Web API (server/CookiesProyect) with Entity Framework Core for data access.
• Purpose: Provide a contacts list app with role-based authorization and automatic token refresh via HTTP-Only cookies.
File structure
• Top-level directories:
• bruno/…: Bruno test scripts (automated API calls).
• client/auth-cookies/: React SPA, including src/components, src/pages, src/routes, src/store, src/config, src/hooks, utilities.
• server/CookiesProyect/: ASP.NET solution with Controllers, Services, Database (DbContext, Entities, Configuration, Migrations, SeedData), Dtos, Helpers, appsettings, Program/Startup.
• Architectural hints:
• Front-end uses a Redux-style store (useAuthStore, actions, hooks).
• Back-end follows an MVC-style layering: Controllers → Services → DbContext → Entities.
• Config files for environment (.env), build (vite.config.js), ESLint, Tailwind.
README for additional insights
• Describes security threat (XSS) and solution (HTTP-Only cookies).
• Highlights endpoints: /api/auth/login, /api/auth/refresh-token, /api/auth/validate, /api/contacts.
• Lists technologies (React, .NET, JWT, EF Core, Cookie auth).
• Mentions live demo URL and sample users.
Detail
• Front-end folder as a sub-component (e.g., src/components, src/store).
• Back-end layer (Controllers, Services, Data).
• Where environment variables (.env, appsettings.json) are loaded.
• HTTP headers vs. HTTP-Only cookies.
• Security boundary around cookies (HTTP-Only flag, SameSite, Secure).