#The Epic Stack

1 messages · Page 1 of 1 (latest)

strong elbow
#

https://www.epicweb.dev/epic-stack

Ditch analysis paralysis and start shipping Epic Web apps. This is an opinionated project starter and reference that allows teams to ship their ideas to production faster and on a more stable foundation based on the experience of myself and contributors.

Epic Web Dev by Kent C. Dodds

Introducing an opinionated project starter that enables web development teams to ship their ideas to production more efficiently.

rocky canopy
#

Very nice so much to learn ♥️👍

harsh rose
#

Great Stack Kent! Joined Remix community 1.5 years ago and you was the one who recommended me to pack some of my stuff into a Stack.

Besides the comments from HN, I think the tools and services you choosed are the ones that we been using into the community from some time already. (So nothing new for me, and that's good!)

Saying this, thank you for sharing the Stack! I'm sure it will help a lot of new folks to speed up their development or keep it as a reference!

weary nova
#

awesome stack, I've been meaning to try out fly because it looks appealing, I think I will give it a go one of these days

radiant iron
#

Excited about this, particularly the bits about Auth and email!

strong elbow
regal moss
#

exciting project. would use this for my upcoming project

strong elbow
rocky canopy
#

Just a small ques if u had used postgres how diff would the auth look?

#

Or just same

past fractal
#

Awesome work Kent. Was really happy to see it on the conference, considering we were just kicking off a new project. This saved us so much time and headaches. Very excited to see how it develops in the future

strong elbow
past fractal
#

Yeah we are building a "client area" for a client of ours. Its like a b2b webshop. Unfortunately a private project so I cant showcase it :(. But I am loving the Epic stack so much. You have really achieved your goal to help us with taking decisions

hearty spruce
#

This is amazing. If anyone wanted to try to chat about how to migrate it to a hosting provider other than fly.io i'd love to be a part of that. (curious about deploying this to aws lambda vs fly.io)

strong elbow
past fractal
#

Yes of course. I think i need some more time working with ti as we just started a few days back but I would love to. Any specific ideas how you wanna do it?

strong elbow
idle shuttle
#

@strong elbow absolutely amazing - thank you! I'm about to start using this today. I'm curious: When you say Stripe will make its way into the stack in the future - most likely - what do you mean? Just in general or more specific like memberships with recurring payments, etc?

strong elbow
weary nova
#

that would be awesome to see @strong elbow , I was thinking of adding stripe generation to Remix Forge so you can easily set it up in epic stack, or your own, would love some extra examples just to have enough reference to make it as generic as possible

strong elbow
idle shuttle
#

@weary nova I love that stripe stack as well as the supabase stripe stack - But like you mentioned, there needs to be more examples of it being integrated. @strong elbow I think a lot of people would be interested in stripe integration / something that sets it up much quicker and easily

strong elbow
weary nova
#

That is my next big milestone as soon as I am done with shadcn ui

weary nova
#

@strong elbow when it comes to contributing, do we need to create a discussion first or just fork and create a PR?

strong elbow
#

Creating a PR is a great way for me to see the impact your suggestion will have on the codebase, but there's always a risk I won't merge for one reason or another

#

For really big things, I prefer an example first + a discussion that links to it

weary nova
#

Yeah I'm not a personal type of guy, but it's not a big thing, at least for now, I will create a discussion and uf you like it I could maybe add it

#

Alright created a proposal, let me know what you think

violet mesa
#

“Proposal: Port to Next JS”

weary nova
#

Port to vanilla js 😎

ebon oar
tepid yarrow
#

What would you like to use:
] Remix
Next
ES5 JavaScript
MS Silverlight
An actual live tank mine

strong elbow
#

Choices are for another stack. We're here to ship 🕶️ epicstack

tepid yarrow
#

This is the way

rocky canopy
#

Is the stack working I am on a new pc and sentry is giving me trouble

#

Basically it downloads the sentry.exe and gives me checksum match failed

#

Maybe the checksum is hard-coded and sentry just got updated or something

strong elbow
#

You may consider removing that dependency and adding it back if you need it later

rocky canopy
#

kent is there a way to update my template? like we do git pull latest?

#

i see some changes being made to auth files and I am like 4-5 commits behind

past fractal
#

hey @strong elbow . Almost finished with our project and I am trying to setup the fly.io servers. Something I am missing is how to run the db migrations there.
I am getting an error on fly.io

 TypeError: Cannot read properties of null (reading 'id')
2023-06-27T09:50:26Z app[1857933f4e6278] ams [info]    at createUser (file:///myapp/build/index.js?update=1687859399946:636:42)

and i assume its because migrations are not made

past fractal
#

okey its not the migrations but rather the seeds

past fractal
#

Which leads to the follow up question, how do you run the seeds on staging/production?

strong elbow
#

@past fractal I still need to look into this and come up with my own preference here. Feel free to open up a discussion on GitHub and we can talk about it there

harsh rose
#

Hello @strong elbow and @past fractal!
Not sure if you figured out how to run migration seeds at deploy time on Fly.io

I used to compile the seed before and running them from a start.sh file at deployment time.

The problem I had is the memory limit issues on the free plan from Fly,
but with some help I was able to figure it and run my own seeds at deploy time.

Gonna leave here a thread created into the #1006299623083741185 channel, in case could be useful:
(Recommend having a look at the entire thread)
#1080988517452230716 message

Also if I'm not wrong, I think there are easier / better ways to handle this,
but just noticed @past fractal message and wanted to leave here a little hint 🙂

strong elbow
strong elbow
harsh rose
#

Yeah noticed there is a new way to handle the memory limits issue, had no time to look into it, but I will!
Thanks @strong elbow!

rocky canopy
#

Kent if you have time would you mind explaining to me why you chose to make 2 models Roles and permissions

#

we create admin role with admin permission there is no boolean or anything we just check if the person is admin and go through

#

ok i got it we are not checking roles but checking the permissions and fetching the role from the db

#

This means i can make permissions like readonly or writeonly and do requireUserWithPermission('readOnly', request) and even if the user is admin and does not has the writeonly he would only be able to edit

#

so does this mean that roles are useless?

#

you can just have permissions?

weary nova
#

what if you have something thats readOnly but for admin users?

rocky canopy
#

😛

weary nova
#

lmao no worries, I had to think about it for a second too

rocky canopy
#

so alem can you not check like

#
requireUserWithPermission('readOnly', request)```
#

without even needing the role?

weary nova
#
requireAdminUserWithPermission('readOnly', request)
requireNormalUserWithPermission('readOnly', request)

then how do you do this?

rocky canopy
#
requireUserWithPermission('readOnly', request)```
#

I am confused

weary nova
#

I am saying that this allows you to have permissions per user per role

#

some resources might require you to be an admin AND have a permission

rocky canopy
#

thankyou ❤️

#

there were so many thoughts in my head I just can't type but this concludes them

weary nova
#

in my example you have 2 methods, one of em gives you readOnly permissions for admins and other one for normal users, so if you have an admin dashboard you use the first one and you use the second one if its a normal dashboard for example

#

it allows you to go more granular into it

violet mesa
#

then I can change the permissions each role has when I want to enable/disable stuff

tepid yarrow
#

This is how we do permissions as well

rocky canopy
#

Makes sense when I revisit it thank you for the guidance

#

😃

strong elbow
rocky canopy
#

One more question that I just found, race condition in sqlite, i am working with some medical data with patient history and stuff

#

So update might run ones or twice

#

Also is sqlite suitable for this project

#

@weary nova thoughts?

weary nova
#

I think I ain't suited to comment on this one as I have never used sqlite, what I can tell you is that I am also working with medical data and we had to use a custom server that offers it's own instances of DB etc and we used PostgreSQL but they probably have a sqlite available too

rocky canopy
#

Ahok postgres handles race conditions so makes sense

#

If I switch to postgres adapter will the cache script in the stack still run since it has a no SQL DB anyways?

strong elbow
rocky canopy
strong elbow
#

I may misunderstand your problem, but it sounds like you've got a transaction/idempotency related issue

#

I can't think of why any query would run twice unless you are running it twice.

rocky canopy
#

My brother encountered this problem so sometimes call it a network issue on the user side or something 2 diff user updated the same receipt

#

He uses php and mysql

#

It was rare but it did happen like 5 or 6 times a month

strong elbow
#

Yeah, read the article I linked. It talks about how to avoid these kinds of issues.

#

But these sorts of things will happen with any db

rocky canopy
#

I sold him on postgres lol 😬

strong elbow
#

Postgres is fine. SQLite is great

#

Depends on the use case of course.

past fractal
#

Did anyone figure out how to run the seed file on the fly server? I somehow managed to do it on my -staging server but i dont remember how 🤦🏻‍♂️

And now i cant manage to run them on the live app

#

I can easily ssh but fly doesnt seem to let me run the setup command because of no prisma installed

strong elbow
past fractal
#

thanks Kent. I was thinking something like this but in the end i did some effective but very tedious. My seed is very small and simple i need for production so I just wrote it all in sql and ran it via database-cli

rocky canopy
#

few problems :

  1. my prettier does not work neither normal code nor tailwind plugin idk y it used to work only in the initial release.
  2. I just npx created a new project and this warning exists idk y
> format
> prettier --write . --loglevel warn

[warn] Ignored unknown option --loglevel=warn. Did you mean --log-level?
rocky canopy
#

@strong elbow sorry for the ping 🙏

strong elbow
rocky canopy
#

thankyou

strong elbow
hearty spruce
#

m

regal moss
#

created a new project, made couple of changes in the schema file including adding phoneNumber field to the user and taking off the username. i run the migrate dev script and everything seems to work locally but on prod, i get error when a user is creating an account. i presume it's got to do with the migration or maybe the schema change.

maybe it still expects the username field and not the phoneNumber field. I am confused. anyone faced this and can help me out?

#

thanks in advance

harsh rose
#

Hello @strong elbow! I'm testing the totp library Epic Stack released days ago and I'm getting delta: 0 after verifying the OTP.

I was wondering if that it's a validation success, or it just means that the time of the OTP has expired. (Sorry if this is a dumb question!!)

strong elbow
harsh rose
strong elbow
# harsh rose Not a ChatGPT user yet *(and I know that's a shame, gonna go for it asap!)*. All...

Here's what ChatGPT said:

Hey Daniel,

The delta: 0 you're seeing is actually a good sign; it means that the OTP validation was successful. In TOTP (Time-Based One-Time Password) systems, the delta is the difference between the counter value on the server and the counter value from the OTP token. In your case, a delta of 0 indicates that both are perfectly in sync, meaning validation success.

Now, let's talk "clock drift," as Kent suggested. Clock drift happens when the clocks between the server and client (often your phone or other device) start to drift apart over time. TOTP algorithms usually accommodate for some level of clock drift by validating tokens that are a few time steps away from the current time step. So, you could see a non-zero delta value, and that would also signify a successful validation as long as it's within an acceptable range.

Hope that clears things up!

strong elbow
harsh rose
tepid yarrow
#

Even if you don’t do a paid subscription, the free version of ChatGPT can be immensely helpful for answering lots of development questions.

past fractal
#

hello everyone. I have a project running on epic-stack on fly but for some reason my deploys started failing recently and now the whole app crashes.

2024-02-16T09:36:57Z app[080e657a5065e8] ams [info]npm notice Run `npm install -g [email protected]` to update!
2024-02-16T09:36:57Z app[080e657a5065e8] ams [info]npm notice
2024-02-16T09:36:58Z app[080e657a5065e8] ams [info]> start
2024-02-16T09:36:58Z app[080e657a5065e8] ams [info]> cross-env NODE_ENV=production node .
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]Error: Invariant failed
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]    at invariant (file:///myapp/node_modules/tiny-invariant/dist/esm/tiny-invariant.js:8:15)
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]    at init (file:///myapp/build/index.js?update=1708076218901:38:5)
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]    at file:///myapp/build/index.js?update=1708076218901:50:1
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]    at ModuleLoader.import (node:internal/modules/esm/loader:336:24)
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]            ^
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]  code: 'ERR_UNHANDLED_REJECTION'
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]}
2024-02-16T09:36:59Z app[080e657a5065e8] ams [info]Node.js v18.19.1

I havent really made updates recently so I am a bit unsure what would be causing it.

violet mesa
#

easiest option is to do a find for invariant(obj, and then add an error message as the second arg

#

Epic Stack has since switched to @epic-web/invariant which treats the error message as a required arg

past fractal
#

thanks Jacob. I already saw that epic-web has its own version, but thats something i havent had the time to update. Its a client project with low budget so we havent made much updates recently

#

I will try to debug as you suggest

violet mesa
#

most likely it's a transitive dep or something that increased its own version and now there's just something undefined that should have been there

#

you could also consider fly ssh console and look at the minified code at that line

past fractal
#

i checked the local file and I can actually see the line that gives the error

#

its when this function is ran

#
function init() {
  for (let env of requiredServerEnvs)
    invariant(process.env[env], `${env} is required`);
}
violet mesa
#

hmm it should have thrown the error message ${env} is required though

past fractal
#

yeah i think so too. I will check if indeed some env variables are missing and see if it solves it

violet mesa
#

are there other invariant() functions without error messages nearby in the codebase? possibly some incorrect line numbers on the stack trace due to transpilation

#

I never have a lot of trust in the line numbers

#

I am rather confident though that if that line were actually the one erroring, you would have seen the error message in the logs, and that it's probably something else

#

unless of course you just added ${env} is required for debugging and it wasn't present in the server code on deployment

past fractal
#

but yeah, that was the issue. It was totally my fault because I forgot to add one new var, but not having an error made it horrible to debug

#

it works now tho

#

thanks for your help

strong elbow