Skip to content

A .NET 6 / React app to show SpaceX lanches. Using SpaceX Api.

Notifications You must be signed in to change notification settings

moslem-hadi/SpaceX-Launches

Repository files navigation

🚀 SpaceX Launches 🚀

What is used:

  • .Net 6
  • React 18
  • CQRS + MdeiatR
  • Polly and Retry
  • Caching
  • Logging with Serilog
  • Exception Handling
  • MediatR Pipelines
  • AutoMapper
  • NUnit / FluentAssertions / AutoFixture / Moq / MockHttp

To Do:

  • Polly
  • Unit tests
  • Authentication
  • Rate limiting
  • Api versioning
  • Upgrade to SpaceX api v4

How to run:

git clone https://github.com/moslem-hadi/SpaceX-Launches.git

Then go to the folder:

cd SpaceX-Launches

And run docker compose:

docker-compose up -d

Make sure that ports 3000 and 7034 are free


Another approach is to:

  • open the backend solution and run the SpaceXLaunches.WebApi project on port 7034
  • open frontend project in cmd and run
npm i
npm start

Here's what I did:

I used .Net 6 and I have 4 projects:
image

This structure is based on a clean architecture solution. the Infrastructure layer is responsible for implementing the Application layer.
I used MediatR to make my controllers cleaner. used Polly to retry calling the SpaceX API. (e.g. in SpaceXApiService.GetLaunches)

I used MemoryCache to cache some data(e.g. GetOneLaunchQuery.Handle)
I used Serilog for logging and I have a performance logging and a global exception handler that logs errors.
I used AuthoMapper to map Models to DTOs.

For testing, I used NUnit, FluentAssertions, AutoFixture, Moq, and MockHttp

For the frontend, I used React. I called the app SpaceXplorer(SpaceX + explorer) 😁
image

And I have a few components and a service to call my API.
I used pagination and Infinite scroll, so as you scroll down, new data will be fetched.
For the View page, I just used my design from the first page to save some time.

image image