Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add developer support for using next.js to serve generated static files #814

Merged
merged 30 commits into from
Jun 22, 2024

Conversation

sabaimran
Copy link
Collaborator

@sabaimran sabaimran commented Jun 12, 2024

To improve the developer experience for front-end development, we're migrating to Next.js. In order to do this migration page-by-page, we're using static site generation via Next.js. This also helps us avoid making cross site requests from front-end to back-end for the time being, while giving a ramp to separating out server and client if needed for scale down the road.

Dev instructions for using the next.js setup are in the added README.

This adds scaffolding for including the built files in the python package as well as the docker images. Docker setup has been tested locally. In order to verify the build is working as expected, we can navigate to the {khoj_host}:42110/experimental and verify that the experiment page comes up.

This setup works with serving static files included in the src/interface/web folder from the Django app. The key bit for understanding the setup is in the yarn export command in package.json.

- prod.Dockerfile
- docker-compose.yml
- .github/workflows/dockerize.yml
pull_request:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this and make PR builds optional?

Copy link
Contributor

@MythicalCow MythicalCow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very exciting work here towards upgrading our system. Nice work! Left a few changes for making documentation easier to follow and fixing windows usage.

src/interface/web/README.md Outdated Show resolved Hide resolved
src/interface/web/package.json Outdated Show resolved Hide resolved
Copy link
Member

@debanjum debanjum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Interested to see our UX dev velocity increase using a modern front-end frameworks!

src/interface/web/app/layout.tsx Outdated Show resolved Hide resolved
src/interface/web/app/favicon.ico Outdated Show resolved Hide resolved
src/interface/web/next.config.mjs Outdated Show resolved Hide resolved
@sabaimran sabaimran merged commit a53178c into master Jun 22, 2024
7 checks passed
@sabaimran sabaimran deleted the features/next-js-support branch June 22, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants