mattfbacon / BranhamCodes

Website for the Branham Programming Club with algorithmic problem serving functionality
http://branhamcodes.com
GNU Affero General Public License v3.0
3 stars 1 forks source link

Rewrite using NextJS and TS #15

Open lino-levan opened 2 years ago

lino-levan commented 2 years ago

^

mattfbacon commented 2 years ago

This is a server-rendered website. There is no need for a web-app framework.

lino-levan commented 2 years ago

One quick thing just to clarify my request:

I think the current codebase is messy and unmanageable and I think moving to a modern and open-source web framework would help.

mattfbacon commented 2 years ago

Next.js uses React regardless of whether it runs on the server or the client. Our site does not require complicated logic so React is not necessary and Nunjucks (an industry-standard templating framework) is sufficient.

I agree that the codebase is messy. Extracting into modules and functions would help. Make a PR!

TypeScript compilation is already handled automatically. We use ts-node which works for our use case but you can edit the start script to use tsc if you like: "start": "tsc && node dist/index.js". That is not possible for our deployment because the source directory is read-only for security purposes.

lino-levan commented 2 years ago

In my head I always assumed that Nunjucks files ended with .njk. Now that I realize that it IS just Nunjucks it's not as bad. When I have more time I'll create a PR.

From my understanding, ts-node should not be used in production? According to this post on Stackoverflow, we should probably be using the --transpile-only flag. I would either do that or spend some time to do some more proper CI/CD (with something like Jenkins?).

Thanks for clarifying.

OlexG commented 2 years ago

I also think the logs for this application are horrendous. Perhaps move to a better logging tool such as Datadog. Currently, no one is alerted if the site goes down. This is unacceptable

mattfbacon commented 2 years ago

Hmm, these are a lot of good points. Maybe a full reimplementation in Rust would make more sense..

OlexG commented 2 years ago

Hmm, I do not think this makes sense. A rewrite required countless man-hours, hours which we simply don't have.