UnlyEd / next-right-now

Flexible production-grade boilerplate with Next.js 11, Vercel and TypeScript. Includes multiple opt-in presets using Storybook, Airtable, GraphQL, Analytics, CSS-in-JS, Monitoring, End-to-end testing, Internationalization, CI/CD and SaaS B2B multi single-tenancy (monorepo) support
https://unlyed.github.io/next-right-now/
MIT License
1.26k stars 111 forks source link

Improve demo (UI/UX) + better examples #45

Closed Vadorequest closed 4 years ago

Vadorequest commented 4 years ago

Status

PR in progress at https://github.com/UnlyEd/next-right-now/pull/52

Context

@jajourda @samuelcastro I'd like to know what you think about the current demo (e.g: https://nrn-v1-hyb-mst-aptd-gcms-lcz-sty-c1-oylx1iihd.now.sh/fr)

I think we should add more example and restructure those examples (UI/UX)

It's mostly visual, but do you have any idea about how to do it better? Would you like to work on it?

Quick list of stuff we should showcase (IMHO):

Is there anything important we're missing?

samuelcastro commented 4 years ago

So these are my thoughts:

What do you think?

Vadorequest commented 4 years ago

Thanks for the feedback, gonna answer point by point:

- I don't think we need to show up getInitialProps, next.js is slowly moving away from it.

βœ… Agreed. Let's avoid those and focus on the new API getStaticProps and getServerSideProps.

- Include fallback and revalidate would be interesting since they're fairly new features.

βœ… Agreed. How would you like to showcase those 2 features?

- I honestly don't like reactstrap/bootstrap, it'd be great to use styled-system and maybe rebass, they're based off atomic and subatomic design systems.

πŸ€” I don't like bootstrap much either, but I'm not sure about changing it at this point. It's still more commonly known and rather easy to use, while SS/Rebass look like they need more boilerplate to get started. They're interesting, and their advanced compatibility with Emotion is great, I'm just not sure if it's better for getting started, kinda worried about added complexity.

- Would be great to breakdown all pages into reusable components.

βœ… Agreed. I believe it's already the case for components that are actually being reused, like products.

- Targeting the project to serverless would be a good optimization.

πŸ€” Isn't it already the case?

- Considering that GraphCMS is so expensive for production, maybe we should consider other options like Strapi with Graphql or something else.

πŸ”΄ Not right now, I want to avoid changing everything with this PR/branch. GraphCMS is great for POCs because it's free and managed (no need to self-host), which actually reduces complexity for testing things around. I agree that using something else (like Strapi) is probably what people will do in the end, but it's just a matter of changing the API endpoint (and dealing with BC like i18n content).

For this reason, I intend to keep GraphCMS around, maybe we'll add a Strapi example, as an alternative, at some point. But not now.

Also, I'm strongly considering Airtable as the next API alternative, because it's free and isn't as limited as GCMS, and also it's different (REST-ish API) so it's a good use case, and very very good for POCs (may likely become the default preset/demo).

samuelcastro commented 4 years ago
  • Include fallback and revalidate would be interesting since they're fairly new features.

βœ… Agreed. How would you like to showcase those 2 features?

I think we should keep this simple, maybe create a sample fallback page that will be static generated on-demand, maybe something like https://static-tweet.now.sh/

  • I honestly don't like reactstrap/bootstrap, it'd be great to use styled-system and maybe rebass, they're based off atomic and subatomic design systems.

πŸ€” I don't like bootstrap much either, but I'm not sure about changing it at this point. It's still more commonly known and rather easy to use, while SS/Rebass look like they need more boilerplate to get started. They're interesting, and their advanced compatibility with Emotion is great, I'm just not sure if it's better for getting started, kinda worried about added complexity. Ok that make sense, the focus here is more next.js rather than best UI/UX pratices.

  • Targeting the project to serverless would be a good optimization.

πŸ€” Isn't it already the case?

I meant, the target: "serverless" on next.js (https://nextjs.org/docs/api-reference/next.config.js/build-target#serverless-target), but I just realized that deployments to Vercel will automatically enable this target, so we're good.

  • Considering that GraphCMS is so expensive for production, maybe we should consider other options like Strapi with Graphql or something else.

πŸ”΄ Not right now, I want to avoid changing everything with this PR/branch. GraphCMS is great for POCs because it's free and managed (no need to self-host), which actually reduces complexity for testing things around. I agree that using something else (like Strapi) is probably what people will do in the end, but it's just a matter of changing the API endpoint (and dealing with BC like i18n content).

For this reason, I intend to keep GraphCMS around, maybe we'll add a Strapi example, as an alternative, at some point. But not now.

Also, I'm strongly considering Airtable as the next API alternative, because it's free and isn't as limited as GCMS, and also it's different (REST-ish API) so it's a good use case, and very very good for POCs (may likely become the default preset/demo).

Ok, that make sense, once again, that's not the main goal here.

Also I think it would be great to mesure performance to show up how good this setup is in terms of performance, accessibility, best practices and SEO.

This is the current score the demo has on lighthouse:

Screen Shot 2020-05-12 at 10 30 05 AM
Vadorequest commented 4 years ago

I think we should keep this simple, maybe create a sample fallback page that will be static generated on-demand, maybe something like static-tweet.now.sh

Good idea. Re-implementing their Twitter example is possible.

I meant, the target: "serverless" on next.js (nextjs.org/docs/api-reference/next.config.js/build-target#serverless-target), but I just realized that deployments to Vercel will automatically enable this target, so we're good.

I hadn't noticed that. They say we shouldn't opt-in if we use Vercel, so keeping it as it is probably good enough. But I'd like to make it obvious, so I'll add a comment about it for transparency.

Also I think it would be great to mesure performance to show up how good this setup is in terms of performance, accessibility, best practices and SEO.

Great suggestion. I've just gone through https://nextjs.org/blog/next-9-4#integrated-web-vitals-reporting and I believe we could implement it very easily with the built-in Amplitude analytics. Does that sound good?

It'll allow to track performances for each rendering, I'll take a deeper look and add it to to-do things.

samuelcastro commented 4 years ago

Great suggestion. I've just gone through https://nextjs.org/blog/next-9-4#integrated-web-vitals-reporting and I believe we could implement it very easily with the built-in Amplitude analytics. Does that sound good?

Yeah, that sounds great.

I'm excited about this :)

Vadorequest commented 4 years ago

Adding errors to the list:

samuelcastro commented 4 years ago

Should we add the prod rollback if E2E is failing here?

Vadorequest commented 4 years ago

I'll rather open a separate issue

Vadorequest commented 4 years ago

WIP at https://github.com/UnlyEd/next-right-now/pull/52

Vadorequest commented 4 years ago

I'm almost done with the Demo rewrite. Latest demo at https://nrn-v1-hyb-mst-aptd-gcms-lcz-sty-c1-g99eujlm6.now.sh

What's coming next is proper examples for SSG/R with their variations (revalidate, fallback)

Vadorequest commented 4 years ago

Example with fallback mode has been implemented, it was a bit harder than I thought so.

Now, a isSSGFallbackInitialBuild variable is available in all pages as prop, and helps to know if the page was was built during the current "request".

Vadorequest commented 4 years ago

Fallback mode available at https://nrn-v1-hyb-mst-aptd-gcms-lcz-sty-c1-8zo69v8h2.now.sh/fr/examples/native-features/example-with-ssg-and-fallback/111

Vadorequest commented 4 years ago

Revalidate demo available at https://nrn-v1-hyb-mst-aptd-gcms-lcz-sty-c1-i6tj62ina.now.sh/fr/examples/native-features/example-with-ssg-and-revalidate

PR is ready and has implemented all requirements, I'll merge.

Vadorequest commented 4 years ago

Merged through https://github.com/UnlyEd/next-right-now/pull/42/commits/555b44b13b33415bfb0f3b0a7fb1d00debe28ced