Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devluxor/icarus
Find your favourite asteroid!
https://github.com/devluxor/icarus
astronomy express nasa node react typescript
Last synced: about 1 month ago
JSON representation
Find your favourite asteroid!
- Host: GitHub
- URL: https://github.com/devluxor/icarus
- Owner: devluxor
- Created: 2024-11-26T13:00:41.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-26T14:58:49.000Z (about 1 month ago)
- Last Synced: 2024-11-26T15:23:27.558Z (about 1 month ago)
- Topics: astronomy, express, nasa, node, react, typescript
- Language: TypeScript
- Homepage:
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🌠Icarus ðŸŒ
## Find your favourite asteroids
This web application takes leverage of the NASA NeoWs (Near Earth Object Web Service), a RESTful web service for near earth Asteroid information.
## Stack
- The backend server has been written in Node.js (v22.11.0) + Express (v4.21.1);
- The frontend application has been written using React (v18.3.1), with Vite as a building tool, and Axios as a helper service to handle the API calls to the backend server. In the containerized version, a Nginx image has been used to serve the React application.Both projects have been written using TypeScript.
## Installation
### Containerized version
For ease of use, this application has been containerized using Docker Compose (Docker v27.3.1). In order to use it, please follow these steps:
1. Clone this repository:
```sh
git clone https://github.com/devluxor/icarus.git
```2. Then, in the `backend` folder of the root directory, create a file `.env` with the following content:
```txt
PORT=8080
ASTEROID_API_URL=https://api.nasa.gov/neo/rest/v1/feed
ASTEROID_DETAILS_API_URL=https://api.nasa.gov/neo/rest/v1/neo
API_KEY=
```Note that the API KEY must be either `DEMO_KEY` (it won't allow for multiple successive requests, as it works just for demo purposes) or **an official NASA API key**, which can be easily obtainable by completing this [form](https://api.nasa.gov/#signUp).
3. Once this file is created in the `backend` folder, please run the following command:
```sh
docker compose up
```This command will run both containers at the same time, orchestrating the backend and the frontend elements of the application to run together. You will be able to access the UI via the URL .
I opted to expose the backend server API as well in order for the user to query the API directly (i.e.: using Postman), and to check the server won't accept bad user input (for instance, incoherent or invalid dates in the query parameters). The user can access the backend server via the URL .In other circumstances, I would have used a reverse proxy as a third element in the containers' orchestration, and I would only have this proxy's port exposed to the public for better security. Note the `.env` file, although it does not contain important secrets, is not copied to the images, as the environment variables are passed directly, on runtime, when the image is created and run.
## Pending tasks; todos.
The most important aspects that are pending to do are:
- Tests
- API pagination
- More sorting functionality
- More processing work of the asteroids for a fuller picture of the asteroid characteristics and astronomical history, as well as improve the performance of the application.
- Further Docker Image building optimizationWith limited time, and limited requests with a single key to the NASA API (it resets every 24 hours), I had to prioritize between adding more features and implementing complete unit, integration and E2E tests. I chose the former, as in a short time, in a project of these characteristics, my opinion is that is worth risking the sacrifice of code coverage for a more enjoyable experience, specially considering the help of the type safety that TypeScript provides. With more time on my hands, no doubt I wouldn't have hesitated on implementing a full testing suite.
## Not containerized version
### Backend (Node version 22.11.0)
1. Clone this repository:
```sh
git clone https://github.com/devluxor/icarus.git
```2. In the `backend` folder of the root directory, create a file `.env` with the following content:
```txt
PORT=8080
ASTEROID_API_URL=https://api.nasa.gov/neo/rest/v1/feed
ASTEROID_DETAILS_API_URL=https://api.nasa.gov/neo/rest/v1/neo
API_KEY=
```Note that the API KEY must be either `DEMO_KEY` (it won't allow for multiple successive requests, as it works just for demo purposes) or **an official NASA API key**, which can be easily obtainable by completing this [form](https://api.nasa.gov/#signUp).
3. Install all dependencies via:
```sh
npm install
```4. Then, start the server by running:
```sh
npm run start:dev
```5. The server will be accessible via the URL
### Frontend (React version 18.3.1)
1. Within the `frontend` folder, please install the dependencies with:
```sh
npm install
```2. Then, start the application with:
```sh
npm run dev
```It will be accessible via the URL with your browser of choice.