Move AppState, AppStateConfig, and from_database() out of server.rs into state.rs so server.rs only contains startup and shutdown logic.