Profile picture

Flashcards App API

Intro

I'm currently learning C# and ASP.NET by following a couple of courses (Pragmatic Rest APIs by Milan Jovanovic and Julio Casal's DotNet Bootcamp) and wanted to challenge myself outside the tutorials by building an API.

This API is for the Frontend Mentors Flashcard App challenge and uses the newer minimal API architecture as opposed to more traditional controllers. I have built several APIs using Django (DRF and Ninja) so the general concept of an API and how to construct it in a RESTful way is not new to me and I could concentrate on the particular ASP.NET implementation.

The repo is available here. My next project will be to build the React frontend, hopefully coming soon. 🙃

App Overview

The idea behind the app is that a user can generate a customised quiz based on their own questions, optionally filtered by categories. Questions have a 'confidence level' that can then be updated on completion of a quiz to track learning.

The app includes certain things I wanted to explore as part of my wider C# and ASP.NET learning, such as:

  • Minimal API architecture for CRUD
  • Authentication/Authorisation via JWT and ClaimsPrincipals
  • Cookie based refresh tokens
  • User management (including registration)
  • Entity Framework and code first migrations
  • Fluent API
  • Navigation properties
  • Data transfer objects and custom mappings
  • Pagination
  • Custom services registered with the DI container
  • Documentation via Swagger
  • Related projects in the same solution (console app for data seeding)
  • Basic unit/integration testing configuration with xUnit
  • Extension methods
  • Interfaces
  • Enums

App Screenshots

Flashcards API resources
Flashcards API resources
Flashcards API schemas
Flashcards API schemas

Database Schema

Flashcards database schema
Flashcards database schema

The Quiz itself has no entity as it is purely dynamic and is generated as required from an incoming request. There is however no reason that the API could not be expanded to include a Quiz entity which could then store potentially useful data on a Quiz such as user, score, date taken etc which could then be viewed as some sort of history or analytics.