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

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

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!


export const metadata: Metadata = {
title: "Khoj AI",
description: "Your, open-source, personal AI assistant",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description: "Your, open-source, personal AI assistant",
description: "Your open, personal AI",

or to match the description on the other clients (desktop, emacs, obsidian)

Suggested change
description: "Your, open-source, personal AI assistant",
description: "An AI copilot for your Second Brain",

Copy link
Member

Choose a reason for hiding this comment

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

The favicon isn't seeming to be loaded, used by the next.js web app?
Khoj_Nextjs_NoFavicon

Comment on lines +34 to +41
{
protocol: "https",
hostname: "khoj-web-bucket.s3.amazonaws.com",
},
{
protocol: "https",
hostname: "khoj-generated-images.s3.amazonaws.com",
}
Copy link
Member

Choose a reason for hiding this comment

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

These two s3 buckets shouldn't be required anymore? Those buckets are deprecated

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