Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ Bug reports are welcome, as they make Strata better for everyone who uses it. Cr

If the issue is related to security, please email us directly at strata@navapbc.com

## Testing Changes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can drop this section. The current workflow suggested is still pretty much to develop in a template instance first, then backport to template. I think we'll want to centralize/coordinate doc updates across all the templates for updates to this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How would a user who has pulled down template-application-nextjs know to look to the documentation you reference? I'm not seeing any guidance on the development process within template-application-nextjs, which creates a confusing situation for a developer who wants to contribute an update.

@doshitan doshitan Dec 9, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A good question that needs a consistent (and somewhat centralized) answer across Strata templates. There's a variety of things that need to be pulled together, so let's avoid scattering info further for the moment.


To test your changes, run the `nava-platform` tool with the `--version` argument where the version is the branch containing your changes. For example
```
nava-platform app install --template-uri https://github.com/navapbc/template-application-nextjs --version <MY BRANCH NAME> . <MY TEST APP NAME>
```

## Getting Started

To contribute, create a pull request on GitHub with:
Expand Down
6 changes: 6 additions & 0 deletions template/{{app_name}}/Dockerfile.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM postgres:latest

RUN rm -rf /var/lib/postgresql/data
COPY ./schema.sql /docker-entrypoint-initdb.d/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The app template should provide a db-migrate script for setting up the database, like the other app templates, e.g. https://github.com/navapbc/template-application-rails/blob/7ac4e6636faefaf70add7cc166336960ade8fdf7/template/%7B%7Bapp_name%7D%7D/bin/db-migrate

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Could you give me any more context on this? I used the separate Docker image for the DB because it seemed like the easiest way to pull in initial schema with a sql script. I see that the example you reference runs a Ruby tool called Rake for DB migration. NextJS doesn't have a direct equivalent. What would it look like to follow the pattern you describe without Ruby?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you give me any more context on this?

See https://github.com/navapbc/template-infra/blob/ee6fe10f27716b9f434960052d86634dee85d6fe/template-only-docs/application-requirements.md?plain=1#L11

While it does not seem like we are looking to support a DB in hosted environments here, we should build towards the established patterns. Ideally this should be ensure the postgres client/libraries are available in the container environment, provide a init-db make target (rails, flask), etc. so there's a more completely supported workflow even locally. But that doesn't necessarily have to be done here.

What would it look like to follow the pattern you describe without Ruby?

It should be appropriate to the application framework. In this case if we don't have an actual DB library to use, we should use psql directly (see https://github.com/navapbc/template-infra/blob/ee6fe10f27716b9f434960052d86634dee85d6fe/template-only-app/db-migrate as a reference, though will need some slight adaptation to support the local development usecase).


EXPOSE 5432
29 changes: 29 additions & 0 deletions template/{{app_name}}/docker-compose.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ services:
build:
context: .
target: dev
depends_on:
- {{ app_name }}-database
env_file:
- ./.env
# Add your non-secret environment variables to this file:
Expand All @@ -16,6 +18,8 @@ services:
restart: always
ports:
- {{ app_local_port }}:{{ app_local_port }}
networks:
- {{ app_name }}-network

{{ app_name}}-storybook:
build:
Expand All @@ -30,3 +34,28 @@ services:
restart: always
ports:
- 6006:6006

{{ app_name }}-database:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should follow a similar pattern as is established for the other templates:

(they are not quite normalized yet, but everything should eventually converge)

Which here looks like:

  • Drop the separate container file
  • Update the command
  • Drop the explicit network declaration

Given the Next.js template is often used to build client-side only apps, could also make the DB part conditional on a template variable, but I think we can cross that bridge later as it's easy enough to delete or comment out the DB block if you don't want it.

build:
context: .
dockerfile: Dockerfile.db
environment:
POSTGRES_PASSWORD: secret123
POSTGRES_USER: app
healthcheck:
test: "pg_isready --username=app"
timeout: 10s
retries: 20
ports:
- "5432:5432"
volumes:
- {{ app_name }}-database_data:/var/lib/postgresql/data
networks:
- {{ app_name }}-network

volumes:
{{ app_name }}-database_data:

networks:
{{ app_name }}-network:
driver: bridge
5 changes: 5 additions & 0 deletions template/{{app_name}}/schema.sql.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE DATABASE {{ app_name }};

\c {{ app_name }};

-- Add table creation and initialization below this line.