DEV Community

Cover image for Planning: Using Satellite features in Starchart
TD
TD

Posted on

Planning: Using Satellite features in Starchart

Overview

Starchart is a new project being put together by developers at Seneca College. The project will help students manage SSL certificates and subdomains without too much hassle and free of cost.

The project is currently in the planning phase, and being part of the development team, I have been researching ways to add relevant bits of Satellite in the Remix Blues Stack project, we intend on using for Starchart.

The Plan

After studying Satellite and Remix's Blues Stack source code, I compiled a list of features and functionalities we can port from Satellite. It's better to port features from Satellite rather than replace Remix's Blues Stack server with it, as Satellite comes pre-bundled with some dependencies that we do not require in Starchart.

Proposed Satellite Features

  • Logger
  • Middleware
  • Hash
  • Create Error

Proposed Dependencies used by Satellite

  • pino, pino-http, pino-pretty (to use Logger)
  • http-codes (to use Create Error)
  • Terminus (for health-check and/or shutdown)
  • helmet (for setting http headers)
  • express-jwt (for middleware)
  • cors

Proposed File Structure

After generating a Blues Stack project, we could create a directory named "Satellite" where all the files from Satellite would live. The structure will look similar to the Satellite directory within the Telescope, with only files relevant to Starchart. After installing the needed dependencies, we need to refactor the code to use Typescript and ESM (import/export) syntax to ensure it works.

sample file structure

Server.ts Changes

Since we are using Pino-based logger, we would import logger in server.ts and pass that as a middleware instead of passing morgan.

healthCheck

There's already a route setup for healthCheck in the app directory within Remix Blues Stack project, we could tweak that file to configure terminus using createTerminus function for healthCheck functionality.

Middleware

We could utilize the isAuthorized and isAuthenticated middleware functions to authorize and authenticate users. Also, we could benefit from the errorHandler middleware.

Hash

I am unsure if we need this function, as it's helpful for hashing information that is safe to pass in URLs. We cannot use it for hashing passwords, so if there's no need for hashing information in the URL, we do not need to port this function.

Conclusion

Once the team decides what features and functionalities we need from Satellite, we could start by filing an issue for it in the Starchart repository and go from there.

Top comments (0)